I recently started getting the message
commandline disabled when pressing the
~C escape key in ssh. I thought it must have been something to do with the server I was connected to but it turns out it was my openssh client.
After a recent update I have openssh 9.2 installed and that seems to come with the
~C command line escape sequence disabled by default. To enable it again you need to add the
EnableEscapeCommandline option to your
~/.ssh/config or run the ssh command using the
-o EnableEscapeCommandline=yes. This can be added as a global setting or per host and then the command line will work again.
The change is mentioned on the OpenSSH release notes for 02-02-2023:
ssh(1): add a new EnableEscapeCommandline ssh_config(5) option that controls whether the client-side ~C escape sequence that provides a command-line is available. Among other things, the ~C command-line could be used to add additional port-forwards at runtime. This option defaults to "no", disabling the ~C command-line that was previously enabled by default. Turning off the command-line allows platforms that support sandboxing of the ssh(1) client (currently only OpenBSD) to use a stricter default sandbox policy.