Password-less login
-
Switch to hadoop user
su - hadoop
cd
pwd -
Configuring SSH password-less login
ssh-keygen -t rsa
Enter file in which to save the key: [Return]
Enter passphrase (empty for no passphrase): [Return]
Enter same passphrase again: [Return]
ls -l .ssh(copy public key to authorized_keys file)
ssh-copy-id [email protected] (把公鑰放到我本機我的帳號裡面,目的是讓自己hadoop可以在本機localhost無密碼登入)
ssh-copy-id本身有資安風險,除非是在自己封閉網路的私有雲,或是全部自己管的叢集,否則不要貿然使用。
測試:
-
Test password-less login
ssh [email protected]
exit # logout system -
Copy public key to other servers
ssh-copy-id [email protected]
ssh-copy-id [email protected]
ssh-copy-id [email protected]
ssh-copy-id [email protected] -
Test password-less login to other servers
ssh [email protected]
exit # logout systemssh [email protected]
exit # logout systemssh [email protected]
exit # logout systemssh [email protected]
exit # logout system -
Check authorized_keys file
cd
cat .ssh/authorized_keys
參考資料:https://medium.com/better-programming/how-passwordless-ssh-login-works-711cb9af235