Disable Shell Accounts

Posted on Sunday March 13, 2016 / by Eric Potvin

Disable shell accounts will allow the account to be active without the ability to login on your server.

To see which active accounts are on your server, run:

cat /etc/passwd | egrep -v '\/false|\/nologin|\/shutdown|\/halt' | cut -d':' -f 1,7

You can disable account using this command:

usermod -s /usr/sbin/nologin "username"       (without quotes)

Example of user that can be disabled: