标签:
$ ssh <hostname> #登入 $ exit #登出
1 $ ssh-keygen # 可以加入相关参数选择加密方式,如[-t rsa] 2 #将生成的密钥对中的公钥拷贝到远程服务器上 3 $ scp /Users/(local_username)/.ssh/id_rsa.pub remote_username@remote_host: 4 5 #另一种方式:ssh-copy-id 6 # 附:mac下ssh-copy-id command not found解决办法: 7 # $brew install ssh-copy-id 8 9 #这里的例子里*.pub文件名为id_rsa.pub, 远程主机用户名vagrant, IP:192.168.33.10 10 $ ssh-copy-id -i ~/.ssh/id_rsa.pub vagrant@192.168.33.10 11 /usr/local/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed 12 /usr/local/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys 13 vagrant@192.168.33.10‘s password: #此处需要输入密码 14 15 Number of key(s) added: 1 16 17 Now try logging into the machine, with: "ssh ‘vagrant@192.168.33.10‘" 18 and check to make sure that only the key(s) you wanted were added. 19 $
参考资料:
http://www.ruanyifeng.com/blog/2011/12/ssh_remote_login.html
标签:
原文地址:http://www.cnblogs.com/nwinds/p/4977114.html