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

密钥登录远程服务器

时间:2015-11-16 14:00:47      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:

 

  1. RSA私钥及公钥生成
    1. ssh-keygen -b 2048 -t rsa
    2. Enter file in which to save the key:

    3. Enter passphrase (empty for no passphrase):

    4. Enter same passphrase again:

  2. 上传公钥到服务器端
    1. scp  {local_id_rsa.pub_path}   {remote_host_ip}:{destination_path}
  3. 服务器端配置
    1. cat {destination_path} >> ~/.ssh/authorized_keys
    2. chmod 700 ~/.ssh

    3. chmod 700 ~/.ssh/authorized_keys
    4. vim /etc/ssh/sshd_config
      删除RSAAuthentication和PubkeyAuthentication前的‘#‘号

      RSAAuthentication yes

      PubkeyAuthentication yes

       

    5. 重启ssh
      /etc/init.d/sshd restart

密钥登录远程服务器

标签:

原文地址:http://www.cnblogs.com/03-tornado/p/4968616.html

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