View Full Version : How to disable certain user remote ssh login in ubuntu?
BodyWeapon
November 3rd, 2006, 11:20 AM
Hi,
I have a ubuntu desktop, I have a few users on it.
I only want some of the users can access from ssh remotely.
How to disable certain user remote ssh login in ubuntu? :-k
Please help!
Thanks!
MJN
November 3rd, 2006, 11:29 AM
Check out man sshd_config and use either the AllowUsers or DenyUsers directives in /etc/ssh/sshd_config.
You might also want to include a PermitRootLogin no too.
Mathew
nadamsieee
November 3rd, 2006, 12:22 PM
Edit /etc/ssh/sshd_config:
AllowGroups sshers
Now create the group sshers and add only the users that you want to allow to ssh into your box.
SecurityMonkey
November 3rd, 2006, 04:12 PM
Hi,
I have a ubuntu desktop, I have a few users on it.
I only want some of the users can access from ssh remotely.
How to disable certain user remote ssh login in ubuntu? :-k
Please help!
Thanks!
Another neat trick that you can do:
In the user's home directory, do the following:
1) vi .bash_logout:
#!/bin/bash
echo "Interactive logins are not permitted on this account."
exit
2) chmod 600 .bash_logout
3) chown root:root .bash_logout
Now, when the user goes to ssh to the box, they are told "NO!"
The correct way to do this is mentioned above in sshd_config. However, the method described here works for any interactive login (telnet, ssh, console, etc).
Rick Z
April 1st, 2008, 04:23 PM
This is EXACTLY what I need. Thank you..
vBulletin® v3.8.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.