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! :)
You might also enjoy:
-
Working in the terminal is sometimes like scratching around in the dark as a blind man. You think you have achieved something but you can't see whether or n ...
-
There are a variety of ways you can make private your Apache-driven web content, but without a doubt the most common way is simply to add a .htaccess file i ...
-
If you are new to Linux then chances are high that the damn terminal and sudo command combination are not yet second nature to you, and as such you would mu ...
-
One of the most important things you need to do when setting up your new MySQL server instance is to set the password for the root user account. By default, ...
-
MySQL gets installed with a default root account under the username "root". Sometimes the system will allow you to install a root account without a password ...