[Bug 4008] New: ssh -G prints a control-character EscapeChar as "\^A", which ssh cannot parse back

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Fri Sep 25 13:30:37 AEST 2026


https://bugzilla.mindrot.org/show_bug.cgi?id=4008

            Bug ID: 4008
           Summary: ssh -G prints a control-character EscapeChar as "\^A",
                    which ssh cannot parse back
           Product: Portable OpenSSH
           Version: 10.5p1
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P5
         Component: ssh
          Assignee: unassigned-bugs at mindrot.org
          Reporter: khush2792001 at gmail.com

ssh_config(5) documents EscapeChar as "a single character, '^' followed
by a letter, or
'none'". With the documented "^" form, ssh -G prints the value through
vis(3):

  $ ssh -G -F none -o 'EscapeChar=^a' host | grep escapechar
  escapechar \^A

Feeding that line back to ssh fails:

  $ ssh -G -F none -o 'EscapeChar=^a' host > dump
  $ ssh -G -F dump host > /dev/null
  dump line 78: Bad escape character.
  dump: terminating, 1 bad configuration options

With EscapeChar ~ the dump reads back fine, so ssh -G output is a valid
ssh_config except for
this one keyword (regress/sshcfgparse.sh checks that ssh -G output
reparses, for the options it
covers).

Cause: dump_client_config() in readconf.c prints the escape character
with
vis(buf, o->escape_char, VIS_WHITE, 0), which renders 0x01 as "\^A".
The config parser's
argv_split() keeps the backslash (it unescapes only \', \", \\ and "\
"), and the
oEscapeChar case accepts only a single character or "^" followed by one
character, so the
three-character token is rejected.

Suggested fix: print control characters in the form the parser accepts,
e.g.

        else if (o->escape_char < 32)
                printf("escapechar ^%c\n", o->escape_char + '@');

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list