Create User with Non-Interactive Shell

Software Engineer | Technical Writer
Bread and butter from React and Rails, but currently exploring Linux System Administration and Cloud Solutions/DevOps.
Learning everyday. Follow along with my series on creating Chrome Extensions, Desktop Apps (soon), and PWAs.
Task
The System admin team of
xFusionCorp Industrieshas 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
javedwith a non-interactive shell on theApp Server 2
Information

Implementation
ssh into
App Server 2using assteve:ssh steve@172.16.238.11. Enter password when prompted. Currently only userssteveandansibleexist in this server
Create user
javedwith non-interactive shell:sudo adduser -s /sbin/nologin javed.-sis a flag to set the shell for a user. Below I authenticate asrootso thesudoprefixes 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
nonloginshell 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.txtfile.




