【问题标题】:how do you translate this ssh command into a ssh_config file?如何将此 ssh 命令转换为 ssh_config 文件?
【发布时间】:2015-10-03 09:47:18
【问题描述】:

我正在尝试将此 ssh 命令转换为我的 ssh_config。 ssh_config 中 -L 的等价物是什么?我以为是 localForward,但从我得到的结果来看,它看起来不是那样的。

SSH 命令

sudo ssh -i ~/.ssh/mySSHkey -L 81:<IP1>:81 -L 9200:<IP1>:9200  user@myhost.domain.com

ssh_config 条目

Host logstash
        Hostname                <IP1>
        Port                    81
#        ForwardX11             yes
        LocalForward            81 <IP1>:81
        LocalForward            9200 <IP1>:9200
        User                    username
        IdentityFile            ~/.ssh/mySSHkey
        ServerAliveInterval     30
        ServerAliveCountMax     120
#       LogLevel                DEBUG3

【问题讨论】:

标签: linux ssh command ssh-keys


【解决方案1】:
Host tunnel
HostName database.example.com
IdentityFile ~/.ssh/john.example.key
LocalForward 9906 127.0.0.1:3306
User john

等价于:

ssh -f -N -L 9906:127.0.0.1:3306 john@database.example.com

有了新的配置,你就可以运行了:

ssh -f -N tunnel

来源:http://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-08
    • 1970-01-01
    • 1970-01-01
    • 2019-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多