小编Alv*_*ano的帖子

如何将 ssh_config 与用户匹配一起使用

我正在尝试将 ssh_config (客户端)配置为根据同一主机的用户使用不同的密钥文件,但无法使其工作。怎么了?说的是坏参数

Host myServer
    Hostname myServer.net

Match #bad argument at this line
    Host myServer
    User jhon
    IdentityFile ~/.ssh/jhon

Match
    User foo
    IdentityFile ~/.ssh/foo
Run Code Online (Sandbox Code Playgroud)

----------------------->[已解决]<---------------------- -

Host myServer
        Hostname myServer.net

Match user jhon host "myserver.net"
        IdentityFile ~/.ssh/jhon

Match user foo host "myserver.net"
        IdentityFile ~/.ssh/foo


Host another
        User anyOtherOneUser
        Hostname another.net
        # any other configuration

Match user jhon host "another.net"
        IdentityFile ~/.ssh/jhon-another

Match user foo "another.net"
        IdentityFile ~/.ssh/foo-another

Run Code Online (Sandbox Code Playgroud)

linux openssh identity-management private-key

10
推荐指数
1
解决办法
1万
查看次数

标签 统计

identity-management ×1

linux ×1

openssh ×1

private-key ×1