Linux User with non-interactive shell

Hello, @Hemanthreddy
I think task is about to create a new user with non-interactive shell not just creating a new user.

Hi @a_chhabra, what password you entered for changing as root user. I am able to login but not able to change as root user.

You can use sudo to exec commands with privilege.

I belived the task for creating the user javed was on App2 server.

Hi @Inderpreet I think I performed this task correctly but actually I fail could you help me

@Nes_Leon, the task asks for a non-interactive shell. Your user entry in /etc/passwd has a /bin/bash at the end. bash is an interactive shell

Copy That! thank you so much @francilio!!

1 Like

Hi Team,
Please someone validate and confirm…
created the user with non-interactive shell…

image

Hello Team,

I believe user have been created on the correct server with an interactive shell.

Hello, @Preetesh
I haven’t read about /sbin/false. Can you please tell me why you used that? and any resource link?

Hello Player001

Thank you so much for your response.

I have not used any link, as it was my practice to use “/bin/false” to disable shell for user which can be called a non-interactive shell.

Because I used /sbin/false the task failed, it should be /bin/false.

Some Useful links:

shell - What's the difference between /sbin/nologin and /bin/false - Unix & Linux Stack Exchange.

@Inderpreet

I have performed the task again but it gets failed. Below i have attached the image

Hello, @Preetesh
Because you have added extra slash in the end of nologin. It’s /sbin/nologin not /sbin/nologin/. Hope it will clear your doubts.

Thanks @Tej-Singh-Rana It worked :slight_smile:

@hasmukhrathod…Please follow

ssh user@servername (e.g. ssh banner@stapp03)
adduser “name” -s /sbin/nologin (Make sure you try this from root )

hello guys, follow the below steps

  1. login to appserver
  2. sudo adduser username -s /sbin/nologin .
  3. to check if the user is created, use cmd compgen -u

where we will get login credentials for App server 1.

I have a task to create an user john in App server 1. But How to get the username & passwrd for this App server 1 to get login into it by using ssh. Please suggest

Okkkkk

/sbin/nologin it works

but whyyyyyyyyyyyyy? :slight_smile:

HI @Elsevi ,

The --shell option specifies the user’s login shell. In this case, we are using the nologin shell, which is a non-interactive shell that prevents the user from logging in. This is often used for system accounts that need to run background tasks or services, but do not need to log in to the system.

1 Like