基于key的ssh认证配置步骤

    xiaoxiao2022-07-05  165

    基于密钥的认证: (1) 在客户端生成密钥对

    ssh-keygen -t rsa [-P ''] [-f “~/.ssh/id_rsa"]

    (2) 把公钥文件传输至远程服务器对应用户的家目录

    ssh-copy-id [-i [identity_file]] [user@]host

    (3) 测试

    (4) 在SecureCRT或Xshell实现基于key验证 在SecureCRT工具—>创建公钥—>生成Identity.pub文件 转化为openssh兼容格式(适合SecureCRT,Xshell不需要转化格式),并复制到 需登录主机上相应文件authorized_keys中,注意权限必须为600,在需登录的ssh 主机上执行:ssh-keygen -i -f Identity.pub >> .ssh/authorized_keys

    (5)重设私钥口令:

    ssh-keygen –p

    (6)验证代理(authentication agent)保密解密后的密钥 • 这样口令就只需要输入一次 • 在GNOME中,代理被自动提供给root用户 • 否则运行ssh-agent bash (7)钥匙通过命令添加给代理 ssh-add

    最新回复(0)