Monday, June 18, 2012

How to restrict ssh to the linux users

If you want to restrict or allow particular user to do a ssh you need to take following steps. Based on your configuration it will allow or restrict to do a ssh to particular user/s.

1.  Open a sshd.config file
       " vi  /etc/ssh/sshd_config "
2.   if you want to allow to do a ssh for a particular user/users. you need to add below config to sshd_config file

      "AllowUsers user1 user2"
      Ex : "AllowUsers chamara menul sandya"

3.   if you want to deny to do a ssh for a particular user/users. you need to add below config to sshd_config file


     DenyUsers user1 user2"      
     Ex :   "DenyUsers chamara menul sandya"  
  
4.  Finally save the "sshd_config" file and restart the ssh service
     Ex : /sbin/service sshd restart  (only for a red hat servers)

No comments: