ssh "!command" escape sequence - does it work?

Colin Watson cjwatson at ubuntu.com
Thu Sep 10 15:28:56 UTC 2020


On Thu, Sep 10, 2020 at 03:19:19PM +0100, Chris Green wrote:
> In the man page for ssh_config it says:-
> 
>      PermitLocalCommand
>        Allow local command execution via the LocalCommand option or using the !command escape sequence in
>        ssh(1).  The argument must be yes or no (the default).
> 
> Can anyone point me at something that tells me about "... the !command
> escape sequence in ssh(1)" please.

Here's the relevant bit of documentation from that manual page.  Does
this help?

ESCAPE CHARACTERS
     When a pseudo-terminal has been requested, ssh supports a number of
     functions 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
     character can be changed in configuration files using the EscapeChar
     configuration directive or on the command line by the -e option.

     The supported escapes (assuming the default ‘~’) are:

[...]

     ~C      Open command line.  Currently this allows the addition of port
             forwardings using the -L, -R and -D options (see above).  It also
             allows the cancellation of existing port-forwardings with
             -KL[bind_address:]port for local, -KR[bind_address:]port for
             remote and -KD[bind_address:]port for dynamic port-forwardings.
             !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.

-- 
Colin Watson (he/him)                              [cjwatson at ubuntu.com]




More information about the ubuntu-users mailing list