1.修改sshd_config檔案
vi /etc/ssh/sshd_config //開啟以下内容
HostKey /etc/ssh/ssh_host_rsa_key
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
重新開機sshd服務:systemctl restart sshd
2.建立密鑰
ssh-keygen -t rsa
cat id_rsa.pub >> authorized_keys
3.修改權限
chown -R hadoop:hadoop /home/hadoop
chmod 700 /home/hadoop
chmod 700 /home/hadoop/.ssh
chmod 644 /home/hadoop/.ssh/authorized_keys //公鑰檔案的權限
chmod 600 /home/hadoop/.ssh/id_rsa //私鑰檔案的權限