[[email protected] hadoop]$ start-dfs.sh
Starting namenodes on [bruce02.mydomain]
bruce02.mydomain: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
Starting datanodes
localhost: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
Starting secondary namenodes [bruce02.mydomain]
bruce02.mydomain: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
2018-04-21 14:01:37,865 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

預設情況下是開啟ssh公鑰認證的,需要進行公鑰認證。

偽分散式公鑰認證操作如下:

ssh-keygen -t rsa.
cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys

分散式公鑰認證操作如下:

規劃:bruce01、bruce02可以無金鑰登入三臺主機

bruce01-->bruce01

-->bruce02

-->bruce03

bruce02-->bruce01

-->bruce02

-->bruce03

1、在bruce01上生成一公私鑰對

# su - bruce

$ ssh-keygen -t rsa    (一直回車,rsa為指定的加密演算法)

(執行後,在/home/bruce/.ssh/下生成一對檔案:id_rsa、id_rsa.pub)

2、把公鑰發給bruce01、bruce02、bruce03,會在.ssh/內生成authorized_keys檔案

$ ssh-copy-id bruce01.mydomain   (需要輸入‘yes’和目標節點的密碼)

$ ssh-copy-id bruce02.mydomain

$ ssh-copy-id bruce03.mydomain

(公鑰發給了對方,就可以不用輸入密碼,直接使用私鑰登入到對方的主機)

$ ssh [email protected]     (登入測試)