You are not logged in.

#1 2013-09-07 00:28:42

xtian
Member
Registered: 2013-08-25
Posts: 179

trouble adding ssh keys to gpg-agent--bad passphrase...

I'm working my way through the ssh keys and gnupg tutorials. I'm at the point where I've got to select an agent to handle my ssh keys. I'd like to get more familiar with gpg, so I'm trying to set up the gpg-agent.

The instructions are a bit confusing on this point:

Once gpg-agent is running you can use ssh-add to approve keys, just like you did with plain ssh-agent. The list of approved keys is stored in the ~/.gnupg/sshcontrol file.

"Just like I did with plain ssh-agent"? Then I'd have two agents! I tried to interpret the instructions and apply the same command to what the instructions cite as gpg's approved keys file:

[root@frylock ~]# ssh-add ~/.gnupg/sshcontrol 
Enter passphrase for /root/.gnupg/sshcontrol: 
Bad passphrase, try again for /root/.gnupg/sshcontrol:

But I get errors. I know I'm entering the right passphrase because I've been entering the same darn passphrase so many times creating gpg keys and ssh keys!

What's going on? Am I using ssh-add correctly?

And I know gpg-agent is running:

# ps aux | grep agent
root       477  0.0  0.0   4792   392 ?        Ss   13:11   0:00 gpg-agent -s --enable-ssh-support --daemon --write-env-file /.gnupg/gpg-agent.env
root       524  0.0  0.1   3536   908 ?        Ss   13:11   0:00 gpg-agent -s --enable-ssh-support --daemon --write-env-file /root/.gnupg/gpg-agent.env
root       564  0.0  0.0   4740   388 ?        Ss   13:11   0:00 gpg-agent --daemon
root      1193  0.0  0.1   4556   956 pts/3    S+   16:26   0:00 grep agent 

Last edited by xtian (2013-09-07 00:29:50)

Offline

#2 2013-09-07 00:49:37

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,156

Re: trouble adding ssh keys to gpg-agent--bad passphrase...

xtian wrote:
[root@frylock ~]# ssh-add ~/.gnupg/sshcontrol 
Enter passphrase for /root/.gnupg/sshcontrol: 
Bad passphrase, try again for /root/.gnupg/sshcontrol:

But is that the key you wish to add? My guess is not...

And I know gpg-agent is running:

# ps aux | grep agent
root       477  0.0  0.0   4792   392 ?        Ss   13:11   0:00 gpg-agent -s --enable-ssh-support --daemon --write-env-file /.gnupg/gpg-agent.env
root       524  0.0  0.1   3536   908 ?        Ss   13:11   0:00 gpg-agent -s --enable-ssh-support --daemon --write-env-file /root/.gnupg/gpg-agent.env
root       564  0.0  0.0   4740   388 ?        Ss   13:11   0:00 gpg-agent --daemon
root      1193  0.0  0.1   4556   956 pts/3    S+   16:26   0:00 grep agent 

You should only have one instance of gpg-agent (or possibly one per user - do you really want it for root?).


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#3 2013-09-07 01:28:49

xtian
Member
Registered: 2013-08-25
Posts: 179

Re: trouble adding ssh keys to gpg-agent--bad passphrase...

To your first question, no. I thought I was adding ssh to gpg. Afterwards I got the same error trying to add ssh keys to ssh as per the wiki page.

And to your second point, yes. I am setting up root access to my remote server from my root account.

As to why there are three processes running--I have no idea why. I've just revisited the wiki's instructions for the zillionth time. From the gnupg page you can recognize the two eval statements:

eval $(gpg-agent --daemon) &

and

eval "$(gpg-agent --daemon --write-env-file "$envfile")"

Where the second instance of this latter statement is being generated is a mystery.

If it makes a difference I will be happy to add an example of ps aux output to the wiki when I get this running. (^_^)

Offline

Board footer

Powered by FluxBB