Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question about setting environment variables for ssh remote execution

393 views
Skip to first unread message

snp...@yahoo.com.hk

unread,
Aug 22, 2008, 4:15:34 AM8/22/08
to
For example, ssh user@host modinfo would complain the command modinfo
is not found on a remote Solaris host.
Need to run ssh user@host /usr/sbin/modinfo to get the desirable
result.

To avoid specifying the full path of a command whenever it is prepared
for ssh execution, is there a quick and dirty way to set the PATH
variable on the fly for ssh to locate and run the command?

Have tried with ~user/.ssh/rc and ~user/.ssh/environment but to no
avail.
Meanwhile, ssh user@host ". .profile; modinfo" looks a bit unwieldy to
me.

Thanks.

OldSchool

unread,
Aug 22, 2008, 12:12:12 PM8/22/08
to

the default PATH is specified at build time, you might do

ssh user@host 'echo $PATH'

and see what you've got to work with. Also see the man page for
sshd_config. You might want to look at PermitUserEnvironment.
If set, it allows sshd to use the "environment" file in the ~/.ssh/
environment to set variables, including PATH. There are adverse
security implications noted

0 new messages