How to block users having OpenSSH key login

For security reasons many server administrators are preferring OpenSSH key login to their servers.

Generally for OpenSSH key login we are using authorized_keys file.

By appending keys to this file we will able to ssh a server.

The default location of the authorized_keys file is ~/.ssh/authorized_keys.

To find and print all authorized_keys file from your server use the below command.

Suppose you want to block an user named from your server then follow below steps.

Now the user tapas will never able to login to your server.

The following two tabs change content below.

Tapas Mishra

Sr. Engineer (DevOps)
Loves to work on Opensource products. Having experience on Linux environment. Knowledge on Public cloud services like AWS, Rackspace, DigitalOcean, Linode. Please don't hesitate to give a comment on the posts. Your comments are my strength.

One thought on “How to block users having OpenSSH key login

Leave a Reply