You are not logged in.
I am trying to make my netbook a bit more secure. Suspend and hibernate are working fine, but I would like to have the computer locked after I resume, having to enter my password to unlock it. How would I do this?
Offline
What are you using to suspend/hibernate your computer? (pm-utils, gnome-power-manager, powerdevil, etc.)
M*cr*s*ft: Who needs quality when you have marketing?
Offline
pm-utils
Offline
Unsure, what desktop environment your using. In KDE you can set the screensaver to lock after a certain time and suspend-to-ram for a time after that.
Setting Up a Scripting Environment | Proud donor to wikipedia - link
Offline
I'm using xfce 4.6
I don't have any screensaver installed, I will install xscreensaver and play around with it.
But I quite often use the hotkeys to suspend or hibernate, xscreensaver won't help with this.
Offline
From the pm-utils manpage:
/etc/pm/sleep.d, /usr/lib/pm-utils/sleep.d
Programs in these directories (we call them hooks) are combined and executed
in C sort order before suspend and hibernate with as argument 'suspend' or
'hibernate'. Afterwards they are called in reverse order with argument
'resume' and 'thaw' respectively. If both directories contain a similar named
file, the one in /etc/pm/sleep.d will get preference. It is possible to
disable a hook in the distribution directory by putting a non-executable file
in /etc/pm/sleep.d, or by adding it to the HOOK_BLACKLIST configuration
variable.
From the xscreensaver-command manpage:
-lock Tells the running xscreensaver process to lock the screen
immediately. This is like -activate, but forces locking as well, even if
locking is not the default (that is, even if xscreensaver's lock resource
is false, and even if the lockTimeout resource is non-zero.)
Note that locking doesn't work unless the xscreensaver process is
running as you. See xscreensaver (1) for details.
Last edited by pointone (2009-03-23 04:08:24)
M*cr*s*ft: Who needs quality when you have marketing?
Offline
you could modify /etc/acpi/handler.sh to do what you need (I use this in conjunction with i3lock that works really good with acpid).
Offline
I was looking for this functionality and started with the points pointone points out. However I didn't find it immediately obvious how to do this. After some scratching of the back of my head I came up with this which works for me. I'll post it in case it be useful for others. Install as "/etc/pm/sleep.d/66screenlock" and don't forget chmod +x
#!/bin/bash
#
# 66screenlock: lock screen at suspend with xscreensaver
#
IS_ACTIVE="$( pidof /usr/bin/xscreensaver )"
case $1 in
hibernate)
# not required.
;;
suspend)
# check if xscreensaver is running. if not, just skip on.
if [ -z "$IS_ACTIVE" ]
then :
else
# run the lock command as the user who owns xscreensaver process,
# and not as root, which won't work.
su "$( ps aux | grep xscreensaver | grep -v grep | grep $IS_ACTIVE | awk '{print $1}' )" \
-c "/usr/bin/xscreensaver-command -lock" &
fi
;;
thaw)
# not required.
;;
resume)
# not required.
;;
*) exit $NA
;;
esac
I didn't need it for hibernation as I have to enter passphrase for mounting encrypted disk at "thaw" (full reboot) anyway. I put the action at suspend rather than resume, as the latter leaves the screen exposed for around 20 seconds (time enough for someone with quick fingers to take action).
"ONLY THOSE WHO ATTEMPT THE IMPOSSIBLE WILL ACHIEVE THE ABSURD"
- Oceania Association of Autonomous Astronauts
Offline