
At my office we have this thing called the "Dude Protocol." When I first started working here I thought it was a neat idea to make people a little more security conscience. The procedure is that if any workstation, laptop, or terminal is left logged in but without someone sitting there using it everyone is allowed (in fact directly ordered) to pull up the email client and send an email message to the "Fun" email list with the subject of "Dude" and then to LOCK the terminal. When people get these messages they are asked to reply back to ONLY the sender with the body of "Sweet." (See Dude Protocol for more details.)
Hitting the Windows-Key + L when walking away is a good habit. However, I have a number of development boxes I work on that are Linux systems as well as my Windows desktop. I wanted a single command I could click on or hot-key to lock all of them. After a lot of experimenting I figured out a nice little way to do this. The control point is my desktop (as I didn't want to open up a listener on Windows). I use SSH agent so that my private SSH key is unlocked while I work.
I have shortened the host names for this example, in reality they are full DNS names.
On my Linux boxes I have one script in ~/bin linked to the names lk (lock) and ul (unlock) scripts:
#!/bin/bash
HOSTS="leelandlx1 leelandlx2"
echo ${0##*/} : running
if [ ${0##*/} == "lk" ] ; then
for H in $HOSTS; do
CMD="ssh $H killall -KILL synergyc synergys"
echo $CMD
$CMD
CMD="ssh $H dcop --user leeland kdesktop KScreensaverIface lock"
echo $CMD
$CMD
done
fi
if [ ${0##*/} == "ul" ] ; then
for H in $HOSTS; do
CMD="ssh $H dcop --user leeland kdesktop KScreensaverIface quit"
echo $CMD
$CMD
CMD="ssh $H killall -KILL kdesktop_lock kdesktop_lock.bin"
echo $CMD
$CMD
CMD="ssh $H /usr/X11R6/bin/xset -display :0 r on"
echo $CMD
$CMD
CMD="ssh $H bin/start_synergy.sh"
echo $CMD
$CMD
done
fi
On my Windows desktop I have the script unlock.bat and lock.bat. Here they are:
@echo off plink leeland@leelandlx lk rundll32.exe user32.dll, LockWorkStation REM taskkill /F /T /IM synergys.exe taskkill /F /T /IM synergyc.exe
@echo off C:\bin\plink leeland@leelandlx ul CD "C:\Program Files\Synergy+" REM If Windows is the Synergy server use these lines REM start /B StartSynergys.lnk REM "C:\Program Files\Synergy+\bin\synergys.exe" --daemon --debug WARNING --name leelanda1 --address :24800 REM If Windows is a Synergy client use these lines start /B StartSynergyc.lnk exit
Comments
Post new comment