
我有以下~/.ssh/config
文件:
Host myserver1
Hostname myserver1.blop.com
User blup
Host myserver2
Hostname myserver2.blop.com
User blup
Host bitbucket.org
RemoteCommand # Want to not take care of global RemoteCommand
RequestTTY no
Host *
User root
RemoteCommand PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}:${PWD}\007"' $SHELL;
RequestTTY yes
我希望RemoteCommand
在登入後在遠端 shell 上更改 PROMPT_COMMAND 的所有伺服器上都有一個預設值。 (這是有效的)該RemoteCommand
選項使與 bitbucket (git) 的連接失敗,並且我沒有找到禁用RemoteCommand
特定主機的方法。
嘗試過:什麼都沒有,空字串""
,$SHELL;
任何想法 ?有RemoteCommand
恢復預設值嗎?
答案1
- 用作
none
值RemoteCommand
。
Host bitbucket.org
RemoteCommand none
RequestTTY no
- 一個替代方法就是簡單地將 bitbucket.org 從預設主機配置中排除:
Host * !bitbucket.org
User root
RemoteCommand PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}:${PWD}\007"' $SHELL;
RequestTTY yes
- 更好的解決方案,對於我的具體問題
RemoteCommand
,添加 aMatch
以僅應用ssh
命令的設定:
只需將其添加到文件頂部即可
Match exec "test $_ = /usr/bin/ssh"
RemoteCommand PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}:${PWD}\007"' $SHELL;
RequestTTY yes