公钥登录配置

xshell中生成公钥

公钥登录配置_第1张图片
公钥登录配置_第2张图片
公钥登录配置_第3张图片

服务器配置

#useradd test1 #新建test1账号,用于使用公钥登录
#cd /home/test1/.ssh
#如果没有此目录就su test1;ssh localhost;系统将会生成对应用户的.ssh目录
#cat id_rsa_2048.pub >> authorized_keys #将生成密钥文件上传到服务器,并将内容追加到authorized_keys文件中
#vi /etc/ssh/sshd_config #添加以下两行,打开RSA与pubkey登录认证
RSAAuthentication yes
PubkeyAuthentication yes
#systemctl restart sshd.service #重启服务生效

你可能感兴趣的:(Linux)