码迷,mamicode.com
首页 > 其他好文 > 详细

[SSH] SSH学习笔记 - 远程登录

时间:2015-11-19 15:01:54      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:

1、SSH登陆/登出命令

$ ssh <hostname>              #登入 
$ exit                        #登出
  •  known_hosts
    • 每个用户都有自己的known_hosts文件,路径:(username)/.ssh/known_hosts
    • /etc/目录下的known_hosts文件

2、登录方式:

  • 输入密码登陆
  • 公钥登陆

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.10s 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

 

[SSH] SSH学习笔记 - 远程登录

标签:

原文地址:http://www.cnblogs.com/nwinds/p/4977114.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!