4 ms·
> ssh can be configured on the receiving side so that it runs a particular command Yes — but it will always, ALWAYS launch your shell as (typically) defined in
by Wicher 3y ago
> ssh can be configured on the receiving side so that it runs a particular command
Yes — but it will always, ALWAYS launch your shell as (typically) defined in /etc/passwd, and will pass it two string arguments: "-c" "and your particular command with arguments and all". Go strace it, go look at the argument vector, you'll see.
Thus if your shell is bash, zsh, tcsh, dash, sh, whatever: the moment that it sees and tokenizes "and your particular command with arguments and all", you'll have lost.
The only winning move is not to play.
> Configuring ssh to run a dedicated command line is probably an underutilized, underrated mode of operation.
Perhaps, but in any case, it doesn't save you. As I explained above, your shell runs first, so you've already lost. Maybe it's not underrated, maybe it's rated exactly right because of this problem!
But what if I tell you you can make your problems go away. You juuuuuust have to use this very special shell. I don't want to be downvoted for linking it for a third time on this page, so I won't. Thus: see my other comments on this page :-)