1. Using the Ssh-keygen tool to generate a public private key
SSH-KEYGEN-T rsa-b 1024
Enter the password as prompted, and a public private key is generated.
2. Add the public key to the remote server
For example,/users/apple/.ssh/id_rsa and/users/apple/.ssh/id_rsa.pub are generated.
Note Backup
Id_rsa is the private key, Id_rsa.pub is the public key
Add the public key content to the remote server, as added, one line at a public key. (for Root account)
Cat/users/apple/.ssh/id_rsa.pub
650) this.width=650; "Title=" Image (Ten) "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" Image (Ten) "Src=" http://s3.51cto.com/wyfs02/M01/76/68/ Wkiol1zsy8vy60t8aabq5qzokjm648.png "" 704 "height=" "/>
3. Login Server
Using ssh-i/users/apple/.ssh/id_rsa [email protected] Remote IP
4, remote server non-root account login processing
If you log on to a remote server and use a non-root account, you will also need to modify the directory and file permissions under the remote root account.
chmod 700/home/non-root account/.ssh/
chmod 644/home/non-root account/.ssh/authorized_keys
MAC OS x system generates SSH public private key