sshd_key认证

# info
# CentOS 7.3 64位
  • 生成认证key
    ssh-keygen
    
    Generating public/private rsa key pair.
    # 指定保存加密字符的文件(使用默认)
    Enter file in which to save the key 
    Created directory '/home/USERNAME/.ssh'.
    # 设定密码(使用默认空密码)
    Enter passphrase (empty for no passphrase):
    # 确认密码
    Enter same passphrase again:
    Your identification has been saved in /home/USERNAME/.ssh/id_rsa.
    Your public key has been saved in /home/USERNAME/.ssh/id_rsa.pub.
    The key fingerprint is:
    ※※※
    
    /home/USERNAME/.ssh/id_rsa私钥(钥匙)
    /home/USERNAME/.ssh/id_rsa.pub公钥(锁)
  • 加密服务器
    ssh-copy-id -i /home/USERNAME/.ssh/id_rsa.pub [email protected]
    
    Now try logging into the machine, with:   "ssh '[email protected]'"
    and check to make sure that only the key(s) you wanted were added.
    
    authorized_keys存在于/home/USERNAME/.ssh/代表加密完成
  • 分发密钥
    scp [email protected]:/home/USERNAME/.ssh/id_rsa ~/.ssh/
    
发布了80 篇原创文章 · 获赞 18 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/C_abua/article/details/104318579