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:

[[email protected] ~]# ssh [email protected]
:::Hai, Welcome to crybit's SSH:::
[email protected]'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

Linux Systems Architect at Endurance International Group. I know her (Linux) since many years. Linux lover. Like to play on Linux console. I started this blog to share and discuss Linux thoughts.

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 *