Transfer: https://www.jianshu.com/p/e9db116fef8c
The machine is equipped with hand OSX operating system Macbook Pro, and now I want linux operating system equipped with a terminal server accessed remotely via ssh, password-free access settings by following these steps
1. Generate a private key file
Enter the following command at the client terminal
ssh-keygen -t rsa
Private key file for each execution ssh-keygen -t rsa generated will be different
If the file "~ / .ssh / id_rsa" is present, will be prompted whether to overwrite the file, then select "n" does not overwrite the file and use the existing file id_rsa
If the selected "y" is regenerated "~ / .ssh / id_rsa" file. Next will be prompted to enter the passphrase, enter OK with an empty passphrase, press Enter again (where you can also output passphrase, equivalent password when ssh). Then regenerates id_rsa id_rsa.pub files and file (~ / .ssh the directory)
2. scp remote copy execution command in the terminal
scp /Users/shaarawy18/.ssh/id_rsa.pub [email protected]:~/.ssh
The resulting id_rsa.pub files copied to the remote server ~ / .ssh directory
At this time also you need to enter the root password to access
3. The public key is appended to the authorization KEY inside
Enter the following command at the server terminal
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
If there is already "~ / .ssh / authorized_keys" file on a remote server, you need to edit the server "~ / .ssh / authorized_keys" file, "id_rsa.pub" appended to the contents of the file on the client machine "~ /. ssh / authorized_keys "file.
If there is no "~ / .ssh / authorized_keys" file on the server, execute the following command
cp id_rsa.pub authorized_keys
About to copy the public key as authorized_keys file
4. Test is configured to take effect
command + N new terminal window, enter the login command ssh
At this point you do not need to enter a password to access the remote server