开发者社区 问答 正文

linux中公钥复制到服务端的方法是什么?

linux中公钥复制到服务端的方法是什么?

展开
收起
游客qzzytmszf3zhq 2021-12-05 15:34:16 514 分享 版权
1 条回答
写回答
取消 提交回答
  • [root@localhost ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.10.10
    # 如果没有修改过公钥的默认路径,直接使用ssh-copy-id root@192.168.10.10也是可以的
    /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
    /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
    /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
    root@192.168.10.10`s password: 
    
    Number of key(s) added: 1
    
    Now try logging into the machine, with:   "ssh 'root@192.168.10.10'"
    and check to make sure that only the key(s) you wanted were added.
    
    
    2021-12-05 15:34:39
    赞同 展开评论