这里写目录标题
一、在SSH服务器所在机器上#
1、以root用户登录,更改ssh配置文件 /etc/ssh/sshd_config,去除以下配置的注释
RSAAuthentication yes #启用rsa认证
PubkeyAuthentication yes #启用公钥私钥配对认证方式
AuthorizedKeysFile .ssh/authorized_keys #公钥文件路径
2、重启SSH服务
[root@server /]#systemctl restart sshd //重启ssh服务
二、在客户端机器上#
1、生成公钥和私钥
[root@client /]#ssh-keygen -t rsa
一路默认回车,系统在/root/.ssh下生成id_rsa、id_rsa.pub
2、把id_rsa.pub发送到服务端机器上
[root@client /]#ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.126.136
3、验证
[root@client /]#ssh root@192.168.126.136 #server ip