Task
To enhance security in your datacenter you may want to restrict root logins to your Linux servers to one or few admin servers. So this is how you do it:
How to
Add the following line to your /etc/pam.d/sshd:
account required pam_access.so
to activate sshd to look into the file /etc/pam.d/access.conf for authentication
Now you can use the /etc/pam.d/access.conf file to configure your access conditions (there are a lot possible which are well documented in the file itself). In this case we will configure the SSH Daemon to only grant root access from one specific administration server called “myadminserver.domain.local”. Therefor you need two lines in the access.conf file:
This will allow the root login from myadminserver.domain.local
+ : root : myadminserver.domain.local
And this will deny logins from the rest of the world
- : root : ALL
This is all you need to do. The changes will take effect immediately you don’t need to restart anything.
secure
