I am attempting to set up a scenario in which I do not require to submit a password to ssh into an ubuntu machine from a mac. This is procedure i have been following:

1 - Open a terminal in your mac and remain logged in as you, not root.

2 - ssh-keygen (when asked for a password leave blank, the purpose of this s for rsync to be able to ssh without a password prompt)

3 - cat ~/.ssh/id_rsa.pub

This will have made an SSH key which will now be living in your home folder. Now you need to add the public key into the ubuntu VM

1 – Login as root into the vm

2 – mkdir /home/john/.ssh/

3 - nano /home/john/.ssh/authorized_keys copy the key generated on you mac into the ida_rsa.pub and paste into this file

4 – chown –R john /home/john/.ssh/

5 – chmod 600 /home/john

The result of this is, I have the key in both home directories. But when i ssh john@local.mysite.com i still get asked for a pword..

Any ideas?

Is there a config that must be setup in ssh within the ubuntu machine to allow this behaviour to happen?

  • Can we see the output of ls -la ~john/.ssh on the ubuntu box? Paste it into your question, that way the formatting will be retained. – MadHatter Dec 11 '13 at 8:57

Here's the problem:

chmod 600 /home/john

You're making your home directory non-executable for yourself, which means that any process owned by you can't enter the directory to read its contents - including your ssh keys.

You want chmod 700 /home/john instead. Also chmod 700 /home/john/.ssh; chmod 600 /home/john/.ssh/*

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.