linux机器配置互信

两台机器A和B,现要通过A ssh无密码访问B

1、登录A,执行命令

ssh-keygen -t rsa   

之后一路回车,在/root/.ssh 目录下生成id_rsaid_rs.pub两个文件,id_rsa为私钥,id_rs.pub为公钥
2、公钥拷贝到B机器上:

scp /root/.ssh/id_rsa.pub root@B:/root/

3、登录B,并将该文件追加到/root/.ssh/authorized_keys文件中

cat /root/id_rsa.pub >>/root/.ssh/authorized_keys

4、修改authorized_keys权限

chmod 600 /root/.ssh/authorized_keys

你可能感兴趣的:(linux,&,shell,linux,ssh,免密,互信)