Centos7 ssh 免密登陸
1.、 安裝
2 、配置
sudo vim /etc/ssh/sshd_config
去掉以下内容前的 # 符号,其他内容不需要修改
Port 22
AddressFamily any
ListenAddress 0.0.0.0
ListenAddress
PermitRootLogin yes
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication yes
3、 生成公鑰私鑰對
進入 .ssh檔案夾下
cat id_rsa.pub >> ~/.ssh/authorized_keys
4、 修改檔案權限
sudo chmod .ssh
sudo chmod .ssh/authorized_keys
5、 測試
ssh bigdata001
其中bigdata001 為我的主機名,如果沒有配置主機名的話,這個位置可以直接換成ip,第一次登陸需輸入密碼,第二次即可直接登陸。