Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How to allow user to access system only 1 hour in day using PAM?

For example I wish to give access to a user only for 1hr on a workstation in 24hrs. First the 24hr time period needs to be defined, as fixed time period like 00:00:00 to 23:59:59 or the time period should be counted from the time the user first logs in. One must also consider the possibility if the user logs in for 3 minutes. logs off and logs in, after an hour.

Note: I have successfully configure allow access in time ranges but not only 1 hour in day.

Please give me any example of any service.

share|improve this question
    
Do keep in mind that pam only affects logins. So, once a user is logged in, she can stay logged in forever. –  Dennis Kaarsemaker Apr 15 '13 at 21:04
add comment

2 Answers 2

Looks like you're best bet is pam-script. You can write arbitrary scripts which will pass or fail. You can then configure pam to appropriately pass or fail the stack.

share|improve this answer
add comment

I think you could set it using pam.d/time.conf

with a time of 0000 hours to 2359 hours.

Probably a shell script that cold be written that

pipe out the login time duration each time the user is login to a file each time a user logins again compare the time from both logins. so adding up of period 1 + 2 during period 3 login period. If time exceed the stipulated amount kick the user out.

share|improve this answer
add comment

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.