Table of contents
Task
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
javed
with a non-interactive shell on theApp Server 2
Information
Implementation
ssh into
App Server 2
using assteve
:ssh steve@172.16.238.11
. Enter password when prompted. Currently only userssteve
andansible
exist in this serverCreate user
javed
with non-interactive shell:sudo adduser -s /sbin/nologin javed
.-s
is a flag to set the shell for a user. Below I authenticate asroot
so thesudo
prefixes are unnecessary.
nologin displays a message that an account is not available and closes the connection and returns non-zero. It is intended as a replacement shell field to deny login access to an account.
Learnings
Creating a user with a non-default $SHELL. Th
nonlogin
shell is non-interactive and used for disabling a user account in the case of suspicious activity or upon user workplace/contract termination. The shell can also be updated usingusermod -s
.A custom message can be set for any attempts to log in as the disabled user account by editing/creating a
/etc/nologin.txt
file.