Mac配置ssh免密钥登录

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

猜你喜欢

转载自my.oschina.net/u/3316387/blog/2986445