These examples will limit the login times of certain users. See /etc/security/time.conf for more information/examples. In order to place time restrictions on user logins, the following must be placed in /etc/pam.d/login:
account required /lib/security/pam_time.so
The remaining lines should be placed in /etc/security/time.conf.
Syntax- services ttys;users;times (service-all for all services)( ftp, login, ppp, rexec, rlogin, rsh, su, and xdm.)( tty* & !ttyp*)
1. Only allow user vinod to login during on weekdays between 7 am and 5 pm.
login;*;vinod;Wd0700-1700
3. Allow users vinod & pundir to login on all days between 8 am and 5 pm except for Sunday.
login;*;vinod|pundir;AlSu0800-1700
If a day is specified more than once, it is unset. So in the above example, Sunday is specified twice (Al = All days, Su = Sunday). This causes it to be unset, so this rule applies to all days except Sunday.
*;tty1;root;Al0000-2400
login ↱*;user1|user2|user3;Al0800-1800
No comments:
Post a Comment