Bug 1280 - LocalCommand and variables
Summary: LocalCommand and variables
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 4.3p2
Hardware: All All
: P2 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_5_1
  Show dependency treegraph
 
Reported: 2007-02-03 00:25 AEDT by Chris Jones
Modified: 2008-07-22 12:12 AEST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Jones 2007-02-03 00:25:36 AEDT
LocalCommand does not appear to expand variables, e.g.

LocalCommand /bin/echo %h >/tmp/foo

will just output "%h", it won't be expanded to the hostname being connected to.
Comment 1 Damien Miller 2008-06-12 18:29:36 AEST
Put this on the list for openssh-5.1
Comment 2 Darren Tucker 2008-06-14 07:41:16 AEST
This has now been added and will be in the next release (5.1).

LocalCommand
   Specifies a command to execute on the local machine after suc-
   cessfully connecting to the server.  The command string extends
   to the end of the line, and is executed with the user's shell.
   The following escape character substitutions will be performed:
   '%d' (local user's home directory), '%h' (remote host name), '%l'
   (local host name), '%n' (host name as provided on the command
   line), '%p' (remote port), '%r' (remote user name) or '%u' (local
   user name).  This directive is ignored unless PermitLocalCommand
   has been enabled.

$ ssh -o LocalCommand='echo %u@%h %p' localhost true
dtucker@localhost 22
Comment 3 Damien Miller 2008-07-22 12:12:42 AEST
Mass update RESOLVED->CLOSED after release of openssh-5.1