Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How to disable the keyring for SSH and GPG ?

I would like to keep the keyring for the wifi and other stuff. I'm using Ubuntu 12.04.

share|improve this question
1  
Can't you simply decline to save those passwords on the keyring? For standard ssh, it won't save the password unless you set it up that way specifically, in my experience. –  Marty Fried Jul 12 '12 at 16:12
    
I don't know. Is there a way to reset the keyring. To test it? The title in the topic had Ubuntu 12.04 LTS in it, but @jorge-castro changed it. –  brodul Jul 12 '12 at 16:16
    
Keyring hasn't changed much in a while, but I added it to the question for clarity, no need for it to clutter the title though as the answer will likely apply to multiple versions. –  Jorge Castro Jul 12 '12 at 16:21
add comment

2 Answers 2

up vote 3 down vote accepted

First duplicate the file /etc/xdg/autostart/gnome-keyring-ssh.desktop into ~/.config/autostart/.

Then edit ~/.config/autostart/gnome-keyring-ssh.desktop in order to remove the following line:

NoDisplay=true

and to add the following line at the end:

X-GNOME-Autostart-enabled=false

This should disable SSH management when you restart your session. To disable GPG, do the same with the file /etc/xdg/autostart/gnome-keyring-gpg.desktop.

share|improve this answer
    
Tnx, this finally solves the problem. –  brodul Nov 21 '12 at 12:11
add comment

In a terminal session (using Ctrl-Alt-T) you can stop the gnome-keyring process from working with ssh by using:

unset SSH_AUTH_SOCK 

The --no-use-agent option is available to gpg to avoid using the gnome-keyring process with gpg, however that is the default.

You can stop the nautilus seahorse-tool from using the gpg-agent by using:

rm `echo $GPG_AGENT_INFO | sed s/:0:1//`

You can stop the gnome-keyring process completely with the command:

kill $GNOME_KEYRING_PID

Each of the above actions is restored by logging in again.


Wifi passwords available to all userids are stored in the /etc/NetworkManager/system-connections/ directory rather than being stored in your gnome keyring, so they can remain available if you kill the gnome-keyring process.

The ssh-add command can be used to delete (or add) specific keys from/to the current gnome-keyring while the keyring process is running.

Individual key passwords can be deleted from the login or other keyring using the Passwords tab of the Passwords and Keys program (seahorse).

If the gnome-keyring isn't present, ssh-agent will still be running, but it doesn't store gpg keys.


There are two lines in /etc/pam.d/lightdm involved with saving the login password and starting the gnome-keyring-daemon with the login keyring unlocked with the login password. The second starts the daemon:

session optional        pam_gnome_keyring.so auto_start

Commenting out just this line would stop it from starting for all sessions of all users of your system using the login password to unlock the login keyring.

/etc/xdg/autostart/ contains start entries for various categories of secrets gnome-keyring can handle. To stop the daemon from starting these components these files can be moved out of this directory. You can move all the gnome-keyring-* files to stop the daemon from starting or can simply refuse to supply the login password again to disable the login keyring while leaving the daemon running.

share|improve this answer
    
unset SSH_AUTH_SOCK works. Tnx. Is there a way to unset it for all sessions? I use Enigmail for Thunderbird and there is a problem with enigmail (it doesn't forget the password). –  brodul Jul 15 '12 at 10:52
    
Is there a way to disable the keyring at startup. (I really don't want to write a script killing the keyring). –  brodul Jul 15 '12 at 11:07
    
I've edited the answer with some more information that may be helpful, however it may be better to ask for an Enigmail circumvention directly in a separate question, being explicit about what you want. –  John S Gruber Jul 15 '12 at 15:04
    
You can flush the keyring (forget your passwords, both gpg and ssh and others) by doing gnome-keyring-daemon -r -d. This is simple way of restarting the daemon. One possible problem is that if it wasn't running in the first place, it'll start up (I don't know a good way of only restarting it if it's already running, except parsing ps :/) –  unhammer Mar 18 at 16:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.