How To: Configure LINUX – User Can Login in Specified Days Only
In Redhat Linux operating system we can configure our system that can allow users to login in the system in some specified days of the week with Pluggable Authentication Module (PAM).
#cd /etc/pam.d
#vim login
account required pam_nologin.so
account required pam_time.so
:wq!
By account required pam_time.so placing this line in login file, while login it will invoke this time.conf file. In time.conf file we can configure the login permission for root.
#vim /etc/security/time.conf
root can login into the system only on tuesday at 10 A.M to 7 P.M
last line login;tty*;root;Tu1000-1900
student(guest user/ client) can login into the system only on tuesday at 10 A.M to 7 P.M
last line login;tty*;student;Tu1000-1900 (for users)
root can login into the system only on tuesday at 10 A.M to 7 P.M in terminal 1 (TTY1) only
last line login;tt1;root;Tu1000-1900
root can’t login into system except tuesday, i.e.,on tuesday between 10 A.M – 7 P.M root can login into system. This will be applicable for all terminals
last line login;tty*;root;!Tu1000-1900
root can able to login into the system on monday, tuesday and wednesday between 10 A.M – 7 P.M.
last line login;tty*;root;MoTuWe1000-1900
root can login into the system all days except Monday. i.e, on Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday root can login through any terminal
last line login;tty*;root;AlMo1000-1900
AlMo <<=>> !Mo
Values for days
Mo – Monday
Tu – Tuesday
We – Wednesday
Th – Thursday
Fr – Friday
Sa – Saturday
Su- Sunday
Wk – Weekend
Wd – Weekdays
Al – All Except





