OpenSSH might surprise you – in all the wrong ways

OpenSSH has an unusual approach to handling command line arguments, which the author only discovered after 23 years of using OpenSSH. While assisting a mentee with a script that used ssh to execute remote commands, the author realized that some of the commands didn’t work as expected. Normally, when a command is executed in the shell, the arguments are passed to the program according to shell expansion rules. However, with OpenSSH, the command line arguments containing spaces are split into separate arguments by ssh itself. This behavior is unexpected and can lead to confusion and errors. The author suspects that it may have been a design decision made long ago and is unlikely to change due to compatibility concerns.

To top