有兩種方式:私鑰登入和公鑰登入
私鑰登入:
1 在主機a上生成秘鑰對 ssh-keygen -t rsa -c 「注釋文字」
將生成的秘鑰對中的私鑰id_rsa 複製到將要登入a機器的主機檔案中一班使用字尾.pem,例如 cat id_rsa >> my.pem
2 將上述私鑰檔案交給授權登入的主機,注意,私鑰很重要,不要洩露
可以使用scp 拷貝,或者任何方式, 將私鑰檔案放到授權主機的.ssh目錄下
3 配置授權主機的ssh config
在授權主機的.ssh 目錄建立config檔案
格式如下
host 《主機別名》
hostname 134.123
.123
.123
user ***x
port 22
identityfile ~/.ssh/***x.pem
identityfile 別寫錯了!!!
4 注意事項:
chmod
600 ***x.pem
私鑰檔案需要許可權變更縮小授權範圍
其他注意事項網上很多
5 登入:
ssh 《主機別名》
公鑰登入:
1 在本機上生成秘鑰對 使用ssh-keygen 命令
2 將公鑰拷貝到目標主機的authorized_keys 檔案中
3 配置本機ssh config, 在使用者.ssh目錄下建立config 檔案
host
《主機別名》
hostname
134.123.123.123
user ***x
port
22identityfile ~/.ssh/id_rsa
identityfile 別寫錯了!!!
identityfile 後面為本機生成的私鑰路徑不是公鑰!!
注意檔案許可權!!
4 登入
ssh 《主機別名》
SSH免密登入配置
進入到hadoop使用者家目錄 cd 檢視當前目錄.ssh 隱藏檔案 ls al 進入ssh cd ssh 執行命令生成私鑰id rsa 公鑰 id rsa.pub ssh keygen t rsa 將公鑰內容放入hadoop1的authorized keys 檔案 ssh copy id hado...
SSH 免密登入配置
當你剛擁有乙個伺服器後,首先需要登入伺服器。本節主要聊一聊伺服器ssh登入配置。ssh p port root 12.234.567.789 p port 監聽的埠,如果不指定預設值為 22 vim ssh config 修改 ssh 配置檔案 ssh config host beijing hos...
SSH配置免密登入
linux伺服器ssh免密碼登入 ssh分發秘鑰時出現錯誤 permission denied publickey,gssapi keyex,gssapi with mic ssh免密碼登入permission denied publickey,gssapi keyex,gssapi with mi...