Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to disable login from user avi on Saturday and Sundays, For that I entered this line in /etc/security/time.conf

login;*;avi;Wd0900-1700

For checking this I changed system timing but still possible to login on Saturday and Sunday

what is the mistake here?

share|improve this question

2 Answers 2

*;*;avi;!SaSu0000-2400

This will disable user avi login from Saturday and Sunday.

This is the syntax

`services;ttys;users;times`
     |   |  | |  |  |   |
     *   ;  * ; avi ;!SaSu0000-2400

services----Is a logic list of PAM service names that the rule applies to.

If you enter * here then applies to all services. Instead of * I can enter game login Then it applies to only those services.

ttys----Is a logic list of terminal names that this rule applies to.

Here also same If you enter * Then It applies to all terminal, or you can enter particular tty name also like tty1 tty2, then It affects to only those terminal.

users----Is a logic list of users or a netgroup of users to whom this rule applies.

In my case I entered user name avi. That means these all condition applies to avi only

times----Times field is used to indicate the times at which this rule applies

These are some example lines which might be specified in /etc/security/time.conf.

All users except for root are denied access to console-login at all times:

login ; tty* & !ttyp* ; !root ; !Al0000-2400

Games (configured to use PAM) are only to be accessed out of working hours. This rule does not apply to the user waster:

games ; * ; !waster ; Wd0000-2400 | Wk1800-0800

And the main thing to work this we have to make proper edit inside /etc/pam.d/ directory

dont ask which file...

That is because see this example

share|improve this answer

The login service at the start of the line is for any logins that use /bin/login, nothing else. Try changing login to *, which will affect all services.

Also ensure that time_conf checking is enabled for the services you want in /etc/pam.d. For example, if you want to prevent su access, you need to ensure that the line

account    requisite  pam_time.so

is uncommented in /etc/pam.d/su

share|improve this answer
    
I tried login to * but still same problem... leave it about Saturday Sunday I want make user avi login between 0900-1700. After that not possible to login for that user, what changes should I do now? –  max Aug 30 '12 at 5:07
    
Did you make the changes in the files in /etc/pam.d? It won't work otherwise. Also how are you trying to login? There are various ways. –  teppic Aug 30 '12 at 13:16
    
ya I tried everything, whatever you said its correct, It should work but I don't no why it's not working... Finally I did this *;*;avi;!SaSu0000-2400 then I got the output... It will disable user avi login from Saturday and Sunday. –  max Aug 30 '12 at 13:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.