First, operate on the MAC.
Generate key
ssh-keygen -t rsa
The carriage return uses the default to be good.
add key to Ssh-agent
$ eval "$(ssh-agent -s)"
The PID is printed to indicate that the ssh-agent status is normal and proceed to the next step.
ssh-add ~/.ssh/id_rsa
Add a public key to the Raspberry Pi
Check the local key:
ls -al ~/.ssh
Copy the id_rsa.pub to pi, this copy process has a simple command (Ssh-copy-id), but, the default Mac is not, so we want to install this, you can refer to the online copy, directly download back, install. If you have brew installed, it's easy:
brew install ssh-copy-id
After installation, you can use Ssh-copy-id.
ssh-copy-id [email protected]
Here is my pi username and the IP address of pi.
After the completion, login pi try to see also need not lose password.
ssh [email protected]
Do not log in directly into the password, OK.
Mac Login to Raspberry Pi with SSH key