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 [email protected]
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?
Here's the problem:
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. Alsochmod 700 /home/john/.ssh; chmod 600 /home/john/.ssh/*