1. 生成新密钥,并上传公钥到服务器

    # 生成新密钥
    ssh-keygen -t rsa -m PEM -b 4096 -C "邮箱"
    # 提示可以输入密码,今后认证时服务器和本地用密钥认证,密码用来验证密钥
    
    # 上传公钥到服务器
    scp ~/.ssh/id_rsa.pub 用户名@服务器:~/.ssh/authorized_keys
  2. PowerShell中ssh连接

    ssh 用户名@服务器
    # 可见提示的密码认证是认证本地密钥

    PixPin_2025-08-31_21-42-22.png

  3. Putty中连接
    puttygen打开私钥,提示格式太老,菜单key \ 保存参数设置一下,另存为ppk格式的putty密钥。
    PixPin_2025-08-31_21-35-39.png
    putty中打开保存的会话,connection \ SSH \ Auth \ Credentials,打开之前保存的ppk密钥,重新保存会话。
    PixPin_2025-08-31_21-46-43.png
  4. 参考
    https://blog.csdn.net/black_cat7/article/details/139457572
    https://zhuanlan.zhihu.com/p/587082161
    https://www.dell.com/support/kbdoc/zh-cn/000217157/connectrix-b-series-how-to-use-putty-for-ssh-key-based-authentication
    https://blog.csdn.net/chenzhengfeng/article/details/125827015
    https://blog.csdn.net/knight_zhen/article/details/47001449

标签: none

添加新评论