Linux-SSH password-free login

#vim /etc/ssh/sshd_config
Insert picture description here

Local password-free

[It will be used when configuring hadoop]

1.生成密钥 # ssh-keygen -t rsa -P ''  (在当前目录下生成.ssh文件夹)
【-P表示密码,-P '' 就表示空密码,也可以不用-P参数】
2.# cd /root/.ssh  # ls -a 查看 
id_rsa  id_rsa.pub  known_hosts
3.将公钥文件追加到authorized_keys文件中(修改权限 600)
# cat id_rsa.pub >> authorized_keys
4.验证 #ssh localhostip

Password-free login

1) 在客户端生成密钥对
[root@server ~]# ssh-keygen -t rsa
[root@server ~]# ls .ssh/
id_rsa  id_rsa.pub  known_hosts
	id_rsa		私钥
	id_rsa.pub	公钥
2) 把公钥传送给服务器
[root@server ~]# ssh-copy-id -i  192.168.87.10

Published 52 original articles · won praise 2 · Views 6374

Guess you like

Origin blog.csdn.net/wenwang3000/article/details/99640279