用 ~/.ssh/config 配别名和跳板机,少敲一长串参数

~/.ssh/config 里给主机起别名,之后 ssh 别名 就能连,不用记 IP。

Host 段下写 HostName、User、Port 和私钥路径。

跳板机用 ProxyJump 串起来,IdentityFile 指定私钥路径。

记得 chmod 600 改这两个文件,权限太松会被拒用。

# ~/.ssh/config
Host db
    HostName 10.0.0.12
    User root
    Port 22
    IdentityFile ~/.ssh/id_ed25519

Host inner
    HostName 192.168.1.9
    ProxyJump db
THE END
喜欢就支持一下吧
点赞15 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容