Created attachment 3097 [details] Allocate TTY, allow overriding command Thank you for merging RemoteCommand. I have two feature requests on top of it. 1. When specifying a command line to ssh while RemoteCommand is active, openssh aborts with: "Cannot execute command-line and remote command." I think it would be much better to have a specified command line override RemoteCommand instead. Otherwise it becomes a pain having it active in your config. 2. When using RemoteCommand, no TTY is allocated by default, which makes having shells in RemoteCommand very inconvenient. I have attached a trivial patch taking care of both. Also see comment 9 of bug 2103 (https://bugzilla.mindrot.org/show_bug.cgi?id=2103#c9). Thanks!
Regarding #2 - does RequestTTY=yes not solve this problem?
(In reply to Damien Miller from comment #1) > Regarding #2 - does RequestTTY=yes not solve this problem? Yes, but then RequestTTY must accompany RemoteCommand in every config entry. This isn't always desirable, for example when using a command-line (which is what request 1 in this bug is about).
The TTY allocation is a minor problem. However, the lack of precedence of cmdline command is a much more complex issue. Users have to use ugly hacks like https://unix.stackexchange.com/questions/451253/how-to-configure-ssh-with-a-remotecommand-only-for-interactive-sessions-i-e-wi Please, fix this.
I don't think we should change the precedence, but maybe we could add a "Match command ..." to allow users to specify a RemoteCommand only for cases where none was entered on the commandline.