Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I'm running suse 9.0 on an old pentium as a internet proxy, and users connect remotely to start/stop the dialup connection using PuTTY (a nice program)
Does anyone know how I can "limit" the time that users can logon, and possibly log them out automatically, say between 5pm and 11pm
- basically a time-restriction on logins but not a idle use timeout.
I'm sure you could do this on windows NT4 so you MUST be able to do it in linux :)Thanks for your help

Using the information in /var/log/wtmp ('man last'), write a cron job to periodically check if anyone's logged in too long and kick them off. You'd need to prevent them logging back in immediately with 'passwd -l' and make sure to use 'passwd -u' at some later time.
You can use 'passwd -l' and 'passwd -u' to deny logins between certain times of day using a separate cron job.

If you want to stop everybody (except for root) logging in between specific times, write a cron job that creates a file called /etc/nologin and then another cron job that removes the file at a specific time. The text contents of that file is displayed when a user tried to login (eg Logins on this server are restricted to office hours blah blah...), if the file is empty it just displays "login incorrect" which can sometimes confuse users. NB I think FTP users are still able to login with that file present.

Thanks you guys for taking the time to reply
I am reading the man pages on passwd & cron to try and understand how to use the commands, and will attempt a solution using your advice.
Cheers
YoYo

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |