commandline disabled

If you’re on a Mac and just did an MacOS upgrade, perhaps to Sonoma, you may encounter “commandline disabled” while running a command during your usual ssh workflow.

You were perhaps using the ā€œ~Cā€ as an interrupt to ssh. But now you get “commandline disabled” from the terminal.

What to do?

Add the EnableEscapeCommandline option to your ~/.ssh/config or run the ssh command using the -o EnableEscapeCommandline=yes.

Editing ~/.ssh/config on a Mac:

Start your Terminal.

Go into the directory:

cd ~/.ssh

Open the “config” file.

If the directory does not exist:

mkdir -p ~/.ssh

Create a “config” file:

touch config

Edit the config file:

Add to the top of the file:

EnableEscapeCommandline=yes

Save.

Exit the terminal. Restart the terminal. May need to source for good measure.


REFERENCES

https://www.openssh.com/releasenotes.html

Potentially incompatible changes

* 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.

https://stackoverflow.com/questions/54133300/how-to-access-and-modify-a-ssh-file-on-mac

https://linuxthings.co.uk/blog/openssh-commandline-disabled-fix