Hi,

We have some trouble with students that forget to logout from a workstation, 
and then logs in to next one (and next one...) etc. In tjener there are a 
function to prevent this, but it only works for thin clients. Not discless 
workstations.


I made a small script just to check if they are logged in on another ws while 
logging in. That gives the user a warning and forcingly log them out from that 
new ws to reset usersettings, Iceweasel etc.

Problem is, they are still logged in to the old ws, that is now blocked because 
students dont want to logout people since they dont know if the user has taken 
a paus, or is logged in elsewhere.

Question,is, are there any way to script a forced logout from ws that is no 
longer in use, since they have logged in elsewhere?

Problem is, its easy to force a logout from the ws they are logging in to, 
since you can do that as there own user in a script that is run at login, but 
how would I as administer force a logout from the "old" session on a now unused 
ws where the user is still logged in? Hope you understand what Im getting at.

This is the "warning" script I use, and it helps preventing problems for the 
person that makes several logins without logging out, but it does nothing to 
force a logout on the "old" login, on the former ws.
This script is a part of several login scripts that is run when a user logs in. 
So the file $HOME/.logged_in are created by the main login-script after a 
successful login.


#!/bin/bash
# There are support to prevent multible logins when it comes to thinclients.
# Bad thing it does not help with workstations
# Should be linked into /etc/X11/Xsession.d/10one-login-per-user or something

# Down checks for multiple logins on same host... but not on ws..
# Not needed since we enforce single login on tjener

#num=1
#if [ "$USER" != "root" ]; then
#  num=`who | cut -d" " -f1 | grep "^$USER\$" | wc -l`
#fi
#echo $num
#exit 0

# Could check for user processes before enforce a logout, but it will only work 
if the user logs
# in on a terminal (ltpsp) or the same ws as before. If they log in on another 
ws then pids etc.
# will remain from old login in users homedir and cause problems.

if [ -f $HOME/.logged_in ];then
    l=$(cat ~/.logged_in)
    kdialog --passivepopup "<b>$l</b><br><font size=4 color="red">Den 
inloggningen tas nu bort och du loggas ut. Logga in igen.</font><br><b>Se till 
att logga ut</b>, annars riskerar du att data tappas bort<br>och att 
programinställningar förstörs.." --title "<big><h1>Glömt att logga 
ut?</h1></big>" 10

    # Would  be nice to only kill processes from old login but I dont know a 
way of doing that right now
#    /usr/local/bin/xfce4-session-logout &
    rm -f $HOME/.logged_in
    pkill -KILL -u $USER
else
    # Even if they where loggod out, and since removing ff locks is outside of 
the if statement
    # We try to kill it of so we dont remove locks of a running copy 
unintentionally.
    pkill -u $USER iceweasel
fi
    # Remove any residual firefox locks. 
    # They might stick if user still is logged in to a ws and then log in to 
another ws or tc
    # Or if they forgot to log out and there session gets killed by tjener at 
the end of the day
    # Used to be in above if, but lets try to remove the lockfiles at every 
login to prevent
    # firefox from pushing already started warning at logins.
    rm -f $HOME/.mozilla/firefox/*/lock
    rm -f $HOME/.mozilla/firefox/*/.parentlock

Reply via email to