Have you ever thought to restrict login access to a linux server for security reasons?
One way is to delete any accounts who do not require. But for some reason we can not delete the accounts, because it needed for authentication such as POP3/IMAP.
Well, there's one more way to limit logins without the need to remove users from the system, namely restricting ssh access. How do we do?. We need to edit the OpenSSH configuration file.
[root@snowy ~]# vim /etc/ssh/sshd_config
to allow only user1 and user2, add the the directive 'AllowUser', example
AllowUsers user1 user2
or allow group1 and group2:
AllowGroups group1 group2
to block user user1 and user2, use 'DenyUsers'L
DenyUsers user1 user2
or deny group1 and group2
DenyGroups group1 group2
Save the file and restart the SSHD, assuming we use RHEL or Fedora:
[root@snowy ~]# service sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
Try login after that.
No comments:
Post a Comment