Restricting SSH access by user or group
Depending on the role of your system and which user accounts are configured on it, you may not want all of its registered users to have access through SSH. This recipe shows you how to configure the SSH server to restrict remote user access by explicitly granting or denying the users access.
Getting ready
This recipe requires a CentOS system running the OpenSSH server. Administrative privileges are also required, either by logging in with the root
account or through the use of sudo
.
How to do it...
Follow these steps to restrict users' SSH access:
- Open the SSH server's configuration file with your text editor:
vi /etc/ssh/sshd_config
- Find the
PermitEmptyPasswords
option. Uncomment it and set its value tono
Get CentOS 7 Server Deployment Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.