Wednesday, June 24, 2009

Restricting Access of Local Users to SSHD

How to restrict access of local users to the OpenSSH services?

Step 1: Assuming you want to restrict the user "myfriend", edit the "/etc/ssh/sshd_config" file:

# vi /etc/ssh/sshd_config

Step 2: Insert the following line in the file:

DenyUsers myfriend

Step 3: Save and restart your SSH server:

# /etc/rc.d/init.d/sshd restart


Tested

I have tested the above procedure on CentOS 5.3 with OpenSSH as the SSH server software.


Furthermore

(a) For two or more users, the format of the "DenyUsers" directive is as follows:

DenyUsers user1 user2 user3 user4

(b) To restrict groups, the directive is "DenyGroups". The format is as follows:

DenyGroups group1 group2 group3 group4

No comments: