1. Automatic Ssh/scp method = =
The private key and the public key name are: Id_rsa_192.168.60.110 and id_rsa_192.168.60.110.pub, and then the contents of the Id_rsa_192.168.60.110.pub file are appended to the sever ~/. Ssh/authorized_keys file, and finally, locally use the SSH command-i parameter to specify the local key and log in:
# ssh-i/root/.ssh/id_rsa_192.168.60.110 someone@192.168.60.110
The SCP is the same.
# scp-i/root/.ssh/id_rsa_192.168.60.110 filename someone@192.168.60.110:/home/someone
Here I am using the DSA format key, or I can use the-t RSA parameter to specify the RSA format, I really do not know what their differences; without parameters is probably for SSH1 key format, now few people should use SSH1. Prompt input passphrase (in fact, the equivalent of the private key password), carriage return means no password, where I set a non-empty password. The second step is to upload the public key to the server
$ ssh-copy-id-i ~/.ssh/fwolf_dsa.pub fwolf.com
fwolf@fwolf.com ' s password: Now
try logging into the Machine, with "ssh ' fwolf.com '", and check in:
. Ssh/authorized_keys to make
sure we haven ' t added extra the keys that You weren ' t expecting.
A command to fix, of course at this time we still need the server SSH password, in order to pass the pub key, Ssh-copy-id command will directly add key to the. ssh/authorized_keys file, this and the following approach is the same effect:
$ SCP ~/.ssh/fwolf_dsa.pub fwolf@fwolf.com ...
$ ssh fwolf@fwolf.com ...
$ cat Fwolf_dsa.pub >> ~/ssh/authorized_keys
step three, let's enjoy the fun of automatic login . $ ssh fwolf.com ... Doubt, how still need to enter the password. If you encounter the same problem with me, and pub key upload is not a problem, it is the SSH client configuration is not done, note that the first step I changed the key file default name is not it. So make a copy of/etc/ssh/ssh_config file as ~/.ssh/config, then edit it, change the identityfile ~/.SSH/ID_DSA this line, remove the annotation, add your actual DSA private key file name is OK, And then SSH again:
$ ssh fwolf.com
Enter passphrase for key '/HOME/FWOLF/.SSH/FWOLF_DSA ':
... (Login successful)
step Fourth, get rid of that fucking passphrase. In the third step above, SSH does not need to re-enter the user's password, but still has to enter the passphrase of the private key, which is as troublesome as entering the SSH password, thanks to IBM's blessing, Daniel Robbins introduced us to use ssh-agent and keychain to remove the hassle of typing passwords, but it should not apply to the case where we often need to switch machines, so we have to go back to the first step and generate a pair of keys that don't have a passphrase, although the security is down. , but very convenient. Security Recommendations If conditions permit, use a key with passphrase to use with ssh-agent and keychain. If you need to log on to the server from a different computer, it is best to use a separate key pair. Remember to change the key pair regularly. Reference ADVANCEDOPENSSH generic thread: OpenSSH Key Management, part 1th – Understanding RSA/DSA Authentication Generic Thread: OpenSSH Key Management, part 2nd – Introduction to Ssh-agent and Keychain RSA/DSA Auth Entication on SSH Related posts to open the reverse tunnel with SSH, intranet can also provide services (2) Configure a secure shared Web server (4) Choose Eclipse PHP DEVELOPM ENT tools (PDT) as a PHP development tool (8) use unison to sync your remote folder (9) Install IBUs Input Method (3)