Sometimes it is very useful to manage/assign the SSH authentication to a particular user, Click here for SSH root permission.
There are two directives in SSH configuration file to manage the SH permission for custom users, see the directive details below:
# Allowusers
# Denyusers
You can add the directives if they aren’t in conf file.
How to allow ssh as a user?
Syntax:
# vim /etc/ssh/sshd_config
-----
Allowusers $user1 $user1
-----
Restart SSH daemon
# /etc/init.d/sshd restart
How to denay ssh as a user?
# vim /etc/ssh/sshd_config
-----
Denyusers $user1 $user1
-----
Restart SSH daemon
# /etc/init.d/sshd restart
Replace $user with username which you want.
Example:
Deny the SSH as user “crybit” on server,
# vim /etc/ssh/sshd_config
-----
Denyusers crybit
-----
Restart SSH daemon
# /etc/init.d/sshd restart
Sample output:
[root@localhost ~]# ssh crybit@localhost
:::Hai, Welcome to crybit's SSH:::
crybit@localhost's password:
..
That’s it..! 🙂 🙂
Related Links:
How to create a banner/welcome-note for SSH server
How to disable SSH login as root user – PermitRootLogin
/etc/hosts.allow
/etc/hosts.deny
4 thoughts on “How to manage SSH permission for custom users under your server”