Bug 2558 - Add RemoteCommand option to ssh client
Summary: Add RemoteCommand option to ssh client
Status: CLOSED DUPLICATE of bug 2103
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 7.2p1
Hardware: All All
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-26 11:00 AEDT by main.haarp
Modified: 2016-08-02 10:40 AEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description main.haarp 2016-03-26 11:00:06 AEDT
Something I am sorely missing in the OpenSSH client is the ability to automatically run a command on the remote end after the connection is established. I am proposing a RemoteCommand config option that works like LocalCommand, but on the remote end.

The use case is to have often-needed commands be executed without having to specify them on the command line (as this necessitates searching the shell history or defining aliases). Instead, it should be possible to do this centralized and easy to maintain from the ssh config.

There are numerous cases where this could come in handy:
 - Replace your shell in environments where your user's system shell can't be changed (e.g. embedded systems)
- Execute commands on each login, without having to modify anything on the remote end (e.g. this guy: http://unix.stackexchange.com/q/214004)
 - Execute a shell with special options (e.g. have it use my local bashrc automatically)
- Connect to your screen/tmux session immediately after login
- etc

A cursory search for "ssh automatically run script on login" reveals that this is an often requested feature, which is usually solved by modifying the server end.

Handling this on the remote end (either with command=... in authorized keys or by modifying the shell rcfile) is possible, but not a good solution. It's harder to maintain, not centralized, and you cannot simply change the command without logging in first. command=... also only works with OpenSSH servers.

Therefore, I think RemoteCommand would be a sensible and useful addition to the SSH client.
Comment 1 main.haarp 2016-06-17 17:10:43 AEST

*** This bug has been marked as a duplicate of bug 2103 ***
Comment 2 Damien Miller 2016-08-02 10:40:47 AEST
Close all resolved bugs after 7.3p1 release