Question : Create a Linux User with a non-interactive shell The System Admin Team of XfusionCorp Industries has installed a backup agent tool on all app servers. As per the tool's requirements, they need to create a user with a non-interactive shell.
- /sbin/nologin is specifically designed to switch a shell and produces output complaining you cannot log-in.
- where as /bin/false doesn't give output
Server Name |
IP |
Hostname |
User |
Password |
Purpose |
stapp01 |
172.16.238.10 |
stapp01.stratos.xfusioncorp.com |
tony |
Ir0nM@n |
App 1 |
stapp02 |
172.16.238.11 |
stapp02.stratos.xfusioncorp.com |
steve |
Am3ric@ |
App 2 |
stapp03 |
172.16.238.12 |
stapp03.stratos.xfusioncorp.com |
banner |
BigGr33n |
App 3 |
Solution:
1. At first login to the respective mentioned server in the task. Mine is stapp02
thor@jump_host
/$ ssh steve@stapp02 The authenticity
of host 'stapp02 (172.16.238.11)' can't be established. ECDSA key
fingerprint is SHA256:NgyY+fBF5b56d9UEyUmbNHqK7eZTbk5n5/Ypr19rQkk. ECDSA key
fingerprint is MD5:ef:d2:32:cb:57:6f:44:cb:0c:0b:4f:82:f0:dc:92:70. Are you sure you
want to continue connecting (yes/no)? yes Warning:
Permanently added 'stapp02,172.16.238.11' (ECDSA) to the list of known hosts. steve@stapp02's
password: [steve@stapp02
~]$ [steve@stapp02
~]$ sudo su - We trust you have received the usual lecture from the local System Administrator.
It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great
responsibility. [sudo] password for steve: [root@stapp02 ~]# |
2. 1st check user is existed on the server by below command
[root@stapp02
~]# id ravi id: ravi: no
such user [root@stapp02
~]# |
3. If the user is not found the then you create a user with a non-interactive shell
[root@stapp02
~]# adduser ravi -s /sbin/nologin [root@stapp02
~]# |
4. Validate user is created successfully as per the task request.
[root@stapp02
~]# id ravi uid=1002(ravi)
gid=1002(ravi) groups=1002(ravi) [root@stapp02 ~]# cat /etc/passwd |grep ravi ravi:x:1002:1002::/home/ravi:/sbin/nologin [root@stapp02
~]# |
Happy Learning!!!!
Apart from this if you need more clarity, I have made a tutorial video on this , please go through and share your comments. Like and share the knowledge

4 Comments
is there no voice on the video? I am unable to hear if there's any explanation given.
ReplyDeleteThanks for your comments, I will soon start video with voice
Delete[sudo] password of banner:
ReplyDeletehow i find the password?
I have mentioned password in page. Please used the same
Delete