Is there a way to remove all the ssh keys added to ssh-agent when the user locks the system? - Ask Ubuntu


i have bunch of keys added ssh-agent, keys servers, repositories, etc.

is there way remove ssh keys added ssh-agent when user locks system?

my system right ubuntu desktop 16.04 gnome 3

you can watch events in dbus , on lock call ssh-add -d remove keys agent:

#!/bin/bash dbus-monitor --session "type='signal',interface='org.gnome.screensaver'" |   while read x;     case "$x" in        *"boolean true"*) echo screen_locked; ssh-add -d;;       *"boolean false"*) echo screen_unlocked;;       esac   done 

but need export ssh_auth_sock environment variable script, able access agent.

you can store above script clean_lock.sh, set execute bits (chmod u+x clean_lock.sh) , run script in background ./clean_lock.sh &.


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User