1, create key
[weblogic@v0A-123-100-228 ~]$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/weblogic/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/weblogic/.ssh/id_rsa. Your public key has been saved in /home/weblogic/.ssh/id_rsa.pub. The key fingerprint is: 24:2a:dd:cb:e6:78:7f:d9:71:25:ce:a7:c7:d9:59:d3 weblogic@v0A-123-100-228
2, copy key
[weblogic@v0A-123-100-228 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub weblogic@10.123.100.229 30 weblogic@10.123.100.229's password: Now try logging into the machine, with "ssh 'weblogic@10.123.100.229'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.
3, check login
[weblogic@v0A-123-100-228 ~]$ ssh 'weblogic@10.123.100.229' Last login: Fri Mar 13 20:48:02 2015 from 10.123.100.228 [weblogic@v0A-123-100-229 ~]$
指定ssh端口
[weblogic@v0A-123-100-228 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub 'weblogic@10.123.100.229 -p 8080' weblogic@10.123.100.229's password: Now try logging into the machine, with "ssh weblogic@10.123.100.229 -p 8080", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.
Leave a Reply