Certain user accounts on a Linux system are create with the intention to be used exclusively by some or other service or application. So in order to stop anyone from logging into the machine as that user account, you need to disable the login without disabling the account!

The easiest way to do this is by editing the /etc/passwd to set the user account’s shell to /bin/false instead of the usual /bin/bash.

The recommended way of editing the /etc/passwd file is through the use of vipw which gains an exclusive lock on the file to prevent corruption of the password file through race condition usage.

vipw makes use of vi as its editor, so once it is loaded up, browse through the file to find the user account which you want to edit, switch to the INSERT mode by pressing ‘s’, make your change and return to the command mode by pressing ESC. Enter :exit to close down the editor and save the file.

And that’s all there is to it. Nobody should be able to log in as that system only account! :)