- A為本地主機(jī)
- B為遠(yuǎn)程主機(jī)
在A中生成密鑰并傳到B上脉让。
ssh-keygen -t rsa
scp ~/.ssh/id_rsa.pub ubuntu@xxx.xxx.xx.xx:.ssh/id_rsa.pub
在B上添加A的密鑰铸磅。
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
完成。
如果出現(xiàn)
sign_and_send_pubkey: signing failed: agent refused operation
在A上執(zhí)行:
ssh-add