I use pm-utils for hibernation support.
It has a hooks system which can execute stuff upon hibernate/suspend/thaw/resume/..., but they run as root.
If you want to run stuff as a regular user you could do something like
su $user -c <command>
..but these commands have no access to your user environment.
In my user environment I have a variable which I need access to, namely SSH_AUTH_SOCK, which points to my agent which has some unlocked ssh keys. Obviously you don't want to reenter your ssh key passwords everytime you resume.
(In fact, I started using hibernate/resume because I got tired of having to enter 4 passwords on boot. - 1 for dm_crypt, 1 for login, 2 for ssh keys, not because it is much faster)
The solution is very simple. Use this:
sudo pm-hibernate && do-my-stuff.sh
This way, do-my-stuff.sh will be executed when you resume, after the complete environment has been restored.
Ideal to kill old ssh processes, and setup tunnels and ssh connections again.
I'm probably gonna integrate this into my microDE
posted on Wednesday, 16 Jun 2010 18:11 - link - tags: foss, linux - path: / - 4 comments
Posted by Philip Paeps on Thu Jun 17 11:42:41 2010
I want the possibility to fallback to other hosts in case of unreachability. So that it would try hosts from a list in a specific order.
Afaik autossh does not support this. But it looks like a good tool otherwise, think I'm gonna get in touch with the author :)
Posted by Dieter_be on Thu Jun 17 12:40:16 2010
You can use pam_mount authentication module to mount/umount encrypted partitions with single login/logout.
Posted by booxter on Mon Aug 2 05:41:06 2010
Yeah, and using pam_ssh I can login by unlocking an ssh key, but I prefer this approach because this way I only need to enter 1 password :)
Posted by Dieter_be on Tue Aug 3 15:16:00 2010
Why don't you just use autossh?