#ssh配置跳板機堡壘機帶密鑰
~/.ssh/config
添加以下配置:
# 跳板機地址
Host jumper
HostName jumper.com
User jumper
port 23333
ForwardAgent yes
IdentityFile ~/.ssh/jumper_id_rsa
不行的再看
從網上其他文章來看, 這么配置了就應該生效的。但我這里沒有生效。 需要 手動把 密鑰加到ssh-agent.
$ ssh-add ~/.ssh/jumper_id_rsa
不行的再看(2)
windows里用的mobaxterm
,每次打開都是一個新的會話,加到ssh-agent里的都沒了 。
在.bash_profile
文件里加以下內容:(沒有這個文件的,可以自己生動加)
#ssh
eval $(ssh-agent -s)
ssh-add ~/.ssh/jumper_id_rsa
- 第一行,啟動ssh-agent 客戶端。
- 第二行,添加密鑰到ssh-agent。
就是在每次打開會話時,都添加一次。
其他平台同理。 胖友們自己斟酌。
OVER!