注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

widebright的个人空间

// 编程和生活

 
 
 

日志

 
 

ssh 命令的 ESCAPE CHARACTERS  

2009-04-08 12:15:08|  分类: linux相关 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
ssh 默认的逃避字符之 “~“ ,和telnet里面“ctrl +]”键可以进入命令模式类似,
就是说你在终端输入了这个字符之后,后面跟着的字符就不发給远程机器当作输入了,而是当作
自己ssh客户端的命令了。通过man查看一下ssh的帮助,知道是可以通过 -e 参数来设置这个字符的,
因为老是碰到这么一种情况,我在远程机上的一个程序需要 “ ~.” 来退出,但这个“ ~.”却被本机
当作ssh的断开连接命令了,所以很不方便。下次执行 "ssh -e '?' root@romote.com" 把escape改成问号,
再输 ~. 的时候就可以把这个传给远程命令了,本地的ssh也不用断开。

man ssh

ESCAPE CHARACTERS
     When a pseudo-terminal has been requested, ssh supports a number of func-
     tions through the use of an escape character.

     A single tilde character can be sent as ~~ or by following the tilde by a
     character other than those described below. The escape character must
     always follow a newline to be interpreted as special. The escape charac-
     ter can be changed in configuration files using the EscapeChar configura-
     tion directive or on the command line by the -e option.

     The supported escapes (assuming the default '~') are:

     ~.      Disconnect.
     ~^Z     Background ssh.

     ~#      List forwarded connections.

     ~&      Background ssh at logout when waiting for forwarded connection /
             X11 sessions to terminate.

     ~?      Display a list of escape characters.

     ~B      Send a BREAK to the remote system (only useful for SSH protocol
             version 2 and if the peer supports it).

     ~C      Open command line. Currently this allows the addition of port
             forwardings using the -L and -R options (see above). It also
             allows the cancellation of existing remote port-forwardings using
             -KR[bind_address:]port. !command allows the user to execute a
             local command if the PermitLocalCommand option is enabled in
             ssh_config(5). Basic help is available, using the -h option.

     ~R      Request rekeying of the connection (only useful for SSH protocol
             version 2 and if the peer supports it).


---------------------------------
     -e escape_char
             Sets the escape character for sessions with a pty (default: '~').
             The escape character is only recognized at the beginning of a
             line. The escape character followed by a dot ('.') closes the
             connection; followed by control-Z suspends the connection; and
             followed by itself sends the escape character once. Setting the
             character to ``none'' disables any escapes and makes the session
             fully transparent.
  评论这张
 
阅读(613)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017