1

I'm trying to ssh to myself (I'm running ansible on my local dev machine). I want to be able to ssh to myself without being prompted for my password.

So...

I ran:

ssh-keygen -t rsa

When prompted for the password, left it blank

ssh-copy-id 127.0.0.1

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

chmod og-wx ~/.ssh/authorized_keys

ssh-add

When I then ran ssh 127.0.0.1, it prompted me for a password! What the heck? This error was also thrown:

sign_and_send_pubkey: signing failed: agent refused operation

So I checked out: sign_and_send_pubkey: signing failed: agent refused operation

it says to run ssh-add -l which I did and I got results back.

Also, ~/.ssh is 700 the contents of that directory are 600

How do I keep from getting prompted for a password when using ssh?

MGoBlue93
  • 644
  • 2
  • 14
  • 31

2 Answers2

0

Here's the answer... H/T @maulinglawns on https://unix.stackexchange.com/questions/313106/how-do-i-stop-using-ssh-agent

It's not a ssh-copy-id problem.

It's a gnome problem. If you open a terminal from the desktop, the problem I mentioned happens. If you use tty, then it works as expected.

To get rid of gnome from effing with the ssh agent, perform the following:

mkdir -p ~/.config/autostart
cp /etc/xdg/autostart/gnome-keyring-ssh.desktop ~/.config/autostart/ &&
printf '%s\n' 'Hidden=true' >> ~/.config/autostart/gnome-keyring-ssh.desktop 
MGoBlue93
  • 644
  • 2
  • 14
  • 31
-1

Does it gives password prompt when you try to do:

ssh 127.0.0.1?

If yes, the .pub key has not been added correctly.! You should try again to copy id_rsa.pub key using:

ssh-copy-id 127.0.0.1

above command will prompt you for entering the password, once your enter correct password it will allow passwordless login from the next attempt.

  • Ask your questions under the question as comments. – Amir Fo Jul 02 '18 at 18:14
  • Hmmmm. I'm not sure where you concluded "the .pub key has not been added correctly". I typed the same command you did -- it's in my original post. Moreover, there's not a lot one can do to override or alter the behavior of ssh-copy-id. You just type that with the server as an argument; how can one mess that up? – MGoBlue93 Jul 02 '18 at 20:29