快速配置ssh互信

下載sshpass

sshpass下載地址:http://sourceforge.net/projects/sshpass/ sshpass-1.06.tar.gz 在其中一臺機器上安裝sshpassssh

tar -zxvf sshpass-1.06.tar.gz
cd sshpass-1.06
yum install gcc openssl-devel readline-devel -y
./configure --prefix=/opt/sshpass
make && make install
cp /opt/sshpass/bin/sshpass /usr/bin/

建立公鑰和密鑰

ssh-keygen

本機localhost無密碼登陸

ssh-copy-id localhost

修改/etc/hosts文件,寫入全部節點名和ip

vi /etc/hosts

使用sshpass複製到其它節點上

for i in $(seq -w 002 5);do sshpass -p dlw123 scp -o "StrictHostKeyChecking no" -r .ssh/ hadoop$i:~/;done

參考連接 安裝sshpassoop

相關文章
相關標籤/搜索