23 Mart 2014 Pazar

Disable user login to SSH on RHEL v6.3

1. Disable user login to SSH

Edit the configuration file ; /etc/ssh/sshd_config

To deny users called username1 username2 from logging in via SSH we add the following line to sshd_config file:

DenyUsers username1 username2

Restart the ssh daemon ;  service sshd restart

To allow only users from  logging in via SSH , we add the following line to sshd_config file:
This disables  ssh logins for all other users

AllowUsers username1 username2

Restart the ssh daemon:  service sshd restart


2. Disable SSH Root Login

vi /etc/ssh/sshd_config
find line #PermitRootLogin no
remove the # from the beginning of the parameter

Restart the ssh daemon:  service sshd restart


3. Disable user login to SSH

vi /etc/passwd
in order for a user to disable ssh login :
Add the line for that user in passwd file; sshd:/sbin/nologin

Hiç yorum yok:

Yorum Gönder