Random Linux

Linux, video games and web hosting

If you need to disable shell access for a particular user, that can be done by editing the line for that user in the /etc/passwd file. So if we needed to change it for a user that is named user, you would open that file with a text editor, then change the line that begins with the username. So, when opening that file, you should see something like this:

user:x:526:598::/home/user:/bin/bash

To remove the ability to log in with ssh, you can change the last path to /bin/noshell

user:x:526:598::/home/user:/bin/noshell

Then save the file. Now that user will no longer be able to ssh into your box. This is useful to elevate the security of your machine if you have multiple users and only need ssh on certain ones.

April 7th, 2011

Posted In: How To

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *

*