I have a CentOS machines and below I set this in my access.conf
:
root : ALL
Yet I can login via root and still perform tasks. So what is the job of access.conf
then? Is there anything wrong done here?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityHere you go and get to know how to activate access.conf
I did add following in my access.conf file
[root@lcoalhost ~]# tail -1 /etc/security/access.conf
-:user1:ALL
I added the following in the file "/etc/pam.d/sshd"
[root@localhost ~]# head -3 /etc/pam.d/sshd
#%PAM-1.0
auth include system-auth
account required pam_access.so #I added this line in the file
Specially the 3rd line.
After editing this I tried accessing the server as user :user1:
This is what I saw in the log file "/var/log/secure"
Jan 1 16:40:06 localhost sshd[17981]: pam_access(sshd:account): access denied for user `user1' from `10.0.1.243'
Jan 1 16:40:06 localhost sshd[17981]: Failed password for user1 from 10.0.1.243 port 3186 ssh2
Jan 1 11:10:06 localhost sshd[17982]: fatal: Access denied for user user1 by PAM account configuration
Here "user1" has been denied from any IP. Similarly you can do it for any user.
Here is the log for root
user
Jan 1 16:53:29 localhost sshd[19144]: pam_access(sshd:account): access denied for user `root' from `10.0.1.243'
Jan 1 16:53:29 localhost sshd[19144]: Failed password for root from 10.0.1.243 port 3356 ssh2
Jan 1 11:23:29 localhost sshd[19145]: fatal: Access denied for user root by PAM account configuration
Hope this helps.
+ OR -
before any access control declaration.