How to manage SSH permission for custom users under your server

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

Post navigation

Arunlal Ashok

Cloud Infrastructure / DevOps Engineer. I'm dealing Linux servers since 2012. I started this blog to share and discuss my ideas.

Always happy for an open discussion! Write to arun (@) crybit (dot) com. Check about me for more details. About this blog and our strong members, check The team CryBit.com

4 thoughts on “How to manage SSH permission for custom users under your server

Leave a Reply

Your email address will not be published. Required fields are marked *