3

When using SSH to connect between two mac machines as a standard user passwordless connection works ok on both macs.

But each time when doing the same as root it asks me to enter the passphrase. I got PermitRootLogin without-password in my /etc/sshd-config

What's wrong wish my root? Any ideas why does this happen.

Then: I've tried to add my passphrase to keychain using this method:

$eval "$(ssh-agent)"
$ssh client@macpro.local && ssh-add -K

The keychain window appears but for some reason it doesn’t allow to type in it so I just close it. And after I close it terminal prompts me to enter a passphrase. And after I did I get a connection. So I typed

$ exit

and got this:

Could not create keychain item
Identity added: /var/root/.ssh/id_rsa (/var/root/.ssh/id_rsa)

So it's a keychain problem I believe (or is it supposed to work this way for any reason?) Funny thing that after this I actually don't need to enter the passphrase anymore... until I stop ssh-agent :(((((

I tried this on two macs and get absolutely the same result

Could anyone tell me why keychain [fails|doesn't allow] to save passphrase when sshing as root while it works fine when doing ssh as standard user?

  • Is root enabled on the local Mac? It's not by default. – Tetsujin Feb 21 '15 at 10:26
  • Sorry could you explain what you mean more detailed? – Drew Feb 21 '15 at 19:33
  • Mac isn't like nix, it doesn't have the root account enabled by default, for security, as almost no process on a Mac ever needs root access. See superuser.com/questions/831712/… – Tetsujin Feb 22 '15 at 8:20
  • Oh of course it is enabled. – Drew Feb 22 '15 at 18:55
11

Well finally I've found the answer myself and it solved my problem.

So never use the /usr/local/bin/ssh-add. Use only default /usr/bin/ssh-add which goes with OS X. It works seamlessly with keychain so what I've done is just:

$ /usr/bin/ssh-add -k ~/.ssh/id_rsa

Simple. Now the passphrase is permanently stored in my keychain and I don't need to do ssh-add -k every time I restart my mac.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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