当前位置: 首页 > Linux

两条命令完成ssh免密登录

时间:2023-04-06 06:14:20 Linux

生成公私钥ssh-keygen-b4096-trsa生成的私钥保存在.ssh/id_rsa,公钥上传到.ssh/id_rsa.pub远程服务器的本地客户端输入ssh-copy-iduser@host将公钥上传到远程服务器的.ssh/authorized_keys。修改服务器端的/etc/ssh/sshd_config文件,保证如下参数:RSAAuthenticationyesPubkeyAuthenticationyes此时使用ssh用户@host可以直接登录远程服务器,不需要输入密码。更多:SetupSSHKeystoLoginLinuxWithoutPasswordgenerateSSHkeypairwithsshkeygencommand理解ssh密钥认证