Lab 003: Create a Linux User with non-interactive shell
Lab 003: Create a Linux User with non-interactive shell
Requirements
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.
Therefore, create a user named anita with a non-interactive shell on the App Server 1.
Note
This lab demonstrates creating a Linux user with non-interactive shell for service accounts.
Prerequisites
- SSH access to App Server 1 with root or sudo privileges.
- User management tools available (useradd, grep, su).
Steps
Login to the app server and switch to root. For the server credentials, check out the Project Nautilus documentation.
sshpass -p '******' ssh -o StrictHostKeyChecking=no tony@172.16.238.10
sudo su -
******
[root@stapp01 ~]# useradd -s /sbin/nologin anita
[root@stapp01 ~]# grep anita /etc/passwd
anita:x:1002:1002::/home/anita:/sbin/nologin
[root@stapp01 ~]# su - anita
This account is currently not available.
Verification
- Confirm user
anitaexists withid anita. - Confirm shell is set to
/sbin/nologinwithgrep anita /etc/passwd. - Confirm login attempt fails with "This account is currently not available".