Deny SSH access for a specific user

Sometime we required to deny specific user’s SSH access on Linux box due to security reasons.
In this tutorial i am going to show you simple steps for to Deny SSH access for a specific User
Step 1:
Login as a root user in order to edit “sshd_config” file. Open this file in vi editor.


vi /etc/ssh/sshd_config

Insert below line in sshd_config file.

DenyUsers user0 user1 user2

Save and Exit

Step 2: Now restart ssh service using below command.

Service sshd restart

That’s all

Now user0, user1 and user2 are not allowed to access Linux box via ssh.

Similar Posts