Friday, August 19, 2011

Linux PAM , Lock account in Linux using pam_listfile.so

Dear friend as an admin every day my boss gives a list of different users for login denied


so i use :->

root#passwd -l user1

for that users for locking &

root#passwd -u user1

for unlocking them

but i have 100 users lists every day

so it makes me busy for 1 hr every day

suddenly i remember about file /etc/vsftpd/ftpuser

then for the help of pam.d i applied it to login attempt

I just write in top of the file

root# vi /etc/pam.d/login

auth required pam_listfile.so item=user sens=deny file=/etc/logindeny onerr=succeed

:wq!

& then i create a file & write the name of user which would be denied for that day

root# vi /etc/logindeny

user1

user2

user3

user4

:wq!
& now every day i have to edit only that file & my users are denied for the day

It saves my time daily.