Feature request/EOI: Match interactive config?

openssh at tr.id.au openssh at tr.id.au
Sat May 4 12:16:04 AEST 2024


Hey there,

I often want different behavior in my ssh client depending on whether I'm logging into an interactive session or running a remote non-interactive command. We can see at, say, https://unix.stackexchange.com/a/499562/305714 that this isn't a unique wish, and existing solutions are kind of baroque. Typical reasons to do this are to immediately go into a screen or tmux session; for myself, I often want to relaunch bash as "bash -lo vi" on boxes where I don't have bashrc control. Basically, we want RemoteCommand to be turned on for interactive sessions, but ignore it when we've already specified a command as part of the client invocation.

I wondered if there would be support for, or interest in, adding a new condition called "interactive" (or similar) to the Match keyword? Although my use case is for client-side, I guess it may also make sense in sshd_config. I can imagine cases where sysadmins would want to present different behavior depending on whether a client is coming in interactively or running a command.

Alternatively, could there be a new option which specifies how to resolve conflicts between command-line commands and RemoteCommand directives? Eg something like "RemoteCommandOptional yes" which can be paired with RemoteCommand. This would allow a default RemoteCommand which can be overridden by commands passed on cli.

Or have I overlooked an already-existing simpler/better way of toggling different configurations for interactive vs non-interactive sessions exist, when serverside control is not an option? Sorry if this was already discussed before, nothing from this mailing list turned up in a web search about the topic.

Cheers,

Tim



More information about the openssh-unix-dev mailing list