/etc/profile.d and "ssh -t"
Posted
by
petersohn
on Server Fault
See other posts from Server Fault
or by petersohn
Published on 2012-10-24T10:49:10Z
Indexed on
2012/10/24
11:03 UTC
Read the original article
Hit count: 359
I wanted to run a script on a remote machine. The simple solution is this:
ssh remote1 some-script
This works until the remote script doesn't want to connect to another remote machine (remote2) which requires interactive authentication, like tis one (remote2 is only reachable through remote1 in this case):
ssh remote1 "ssh remote2 some-script"
The solution for the problem is to use the -t option for ssh.
ssh -t remote1 "ssh remote2 some-script"
This works, but I get probems in case I use this (where some-script may execute further ssh commands):
ssh -t remote1 some-script
I found that some environment variables are not set which are set when I don't use the -t option. These envrionment variables are set in scripts from /etc/profile.d. I guess that these scripts are not run for some reason if using the -t option, but are run if I don't use it.
What's the reason of this? Is there any way to work around it? I am using SUSE linux (version 10).
© Server Fault or respective owner