首页 > 代码库 > ssh a host without input the password

ssh a host without input the password

 


$ vim /home/wangzheng/
.ssh/configHost 10.103.xx.xx HostName 10.103.xx.xx
User root 
Port 22022
$ ssh 10.103.xx.xx
The authenticity of host ‘[10.103.xx.xx]:22022 ‘ can‘t be established. RSA key fingerprint is xxxxx:7e. Are you sure you want to continue connecting (yes/no)? yes 
Warning: Permanently added ‘[10.103.xx.xx]:22022‘ (RSA) to the list of known hosts. root@10.103.xx.xx‘s password:

$ ssh-copy-id --help
Usage: /usr/bin/ssh-copy-id [-i [identity_file]] [user@]machine
$ ssh-copy-id 10.103.xx.xx
root@10.103.xx.xx‘s password:
Now try logging into the machine, with "ssh ‘10.103.xx.xx‘", and check in: ~/.ssh/authorized_keys to make sure we haven‘t added extra keys that you weren‘t expecting.
$ ssh 10.103.xx.xx
Last login: Mon Jun 16 10:51:35 2014 from 10.10.106.64 tty:[3] jobs:[0] cwd:[~] ip:[10.103.xx.xx]