LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Logging off and locking out users at specific times (https://www.linuxquestions.org/questions/linux-software-2/logging-off-and-locking-out-users-at-specific-times-142871/)

Kahless 02-06-2004 01:38 AM

Logging off and locking out users at specific times
 
I need a way to log off a user at a specific time, and disable her account until a specific time. I could probally figure out how to make a script that would disable her account by editing the passwd file twice a day, but im not sure how to go about logging her out if she is already signed in. I thought about doing it by having the same script change the run level, but Id much rather not do that just to kick a user off a system.

Also, it would be perferable to have a five minute warning that she is going to be kicked off, so if she is actually doing anything important she can save her files.


This is to make a girl who spends way too much time on the slackware box im loaning her actually do her homework and go to bed, even if her parents arent home.


Any suggestions on where to start, or any programs that may make this easy?

Looking_Lost 02-06-2004 02:16 AM

logoutd may be of use to you

man logoutd

man porttime

Kahless 02-17-2004 12:03 PM

these services seem to work very niceley.

Thanks :)

Kahless 02-19-2004 02:13 AM

ok... almoast there.

the only problem is that a reboot kills logoutd. Putting it in the rc file doesnt make it come up at boot time. any ideas?



from the man page:
logoutd enforces the login time and port restrictions
specified in /etc/porttime. logoutd should be started
from /etc/rc. The /etc/utmp file is scanned periodically
and each user name is checked to see if the named user is
permitted on the named port at the current time. Any
login session which is violating the restrictions in
/etc/porttime is terminated.


i tried creating a file in etc called rc and putting logoutd in it. doent come up at boot.

I tried doing whereis logoutd and putting the full path in the rc.local file (which starts my no-ip.com proggy)... that doesnt work either.



Typing logoutd as root works fine.... but a reboot will let the user back in by killing the service.

Ideas?

Looking_Lost 02-19-2004 07:45 AM

Add

/usr/sbin/logoutd

to the bottom of the /etc/rc.d/rc.M file or you could go the whole hog and use the syntax
the rc.M file uses

if [ -x /usr/sbin/logoutd ]; then
/usr/sbin/logoutd
fi

Kahless 02-19-2004 01:21 PM

When I saw your name as the last poster i knew it would be fixed :)


Thanks, its working great now :)


All times are GMT -5. The time now is 06:31 PM.