Mac終端每次使用ssh -p 22 user@ip登錄很是麻煩,下面介紹配置ssh免密鑰登錄:
cd ~/.ssh下創建conf文件,寫入以下配置:
Host test
HostName ip
Port 22
IdentityFile /Users/t/key/test.pem(你的密鑰文件)
User 服務器名
然後保存,在終端輸入:ssh test即可以登錄了
配置堡壘機:
Host jump
HostName ip
Port 22
IdentityFile ~/.ssh/id_rsa.pub
User mesie
Host target
HostName ip
Port 22
User ubuntu
# IdentityFile ~/.ssh/id_rsa.pub
ProxyCommand ssh jump nc %h %p 2> /dev/null
保存退出,下次進入堡壘機:ssh jump