Description
If for security reasons a local user account (aptare) needs to be denied login access to the portal server using SSH.
Use the following steps to disable (deny) SSH login for a local account:
Edit the DenyUsers directives on the Portal server in the /etc/ssh/sshd_config file.
1) To deny SSH access to specific user called aptare edit /etc/ssh/sshd_config file:
$ sudo vi /etc/ssh/sshd_config
2) Edit the following line and add the user:
DenyUsers aptare
Note: Make sure the space indention is correct. Don't use Space-bar. Press the Tab key and add the username.
3) Restart SSH service to take effect the changes:
$ sudo systemctl restart sshd
4) Now try to SSH to your Linux machine from blocked user account, for example aptare:
$ ssh aptare@xxx.xxx.xxx.xxx
Note: You will get the following message:
aptare@xxx.xxx.xxx.xxx's password:
Permission denied, please try again.
aptare@xxx.xxx.xxx.xxx's password: