SSH無密碼登錄

在這裏提到的不僅僅是爲了hadoop的配置,而是更一般的情況,你可以利用它登錄在其他任意服務器的帳戶,而免去每次輸入密碼的煩惱。由於當初記錄時使用的英文,描述很簡單,這裏就不翻譯了。


1. Connect to host via ssh without password

   i) Generate your private key and public key of your own client:
       $ ssh-keygen -t rsa

   Also, you can generate key with specifying the file storing the private/public key
       $ ssh-keygen -t rsa -f ~/.ssh/id_rsa.github -C "Key, e.g. user name"

   ii) Put the public key on the remote host, append the public key into the authorized_key file

2. Configure of ssh

   If you want to connect to many hosts with different profiles, e.g., different user names, without password. There will be many private key . You need to configure your ssh profiles in your client to tell ssh which . Here is an example:

   Host *.workdomain.com
       IdentityFile ~/.ssh/id_rsa.work
       User lee

   Host github.com
       IdentityFile ~/.ssh/id_rsa.github
       User git

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章