ssh does not execute with remote vars...

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
see NG posting down i got the problem that some servers not starting via
ssh -i ip command option... local it works fine

i testet little bit more...(mailed yesterday about my problem)
local PC (ip .21)
echo $var
ssh -i key ip.21 echo $var
empty line returned..

then i make on the pc from which i wanna connect from lets say ip .24
ssh -i key ip.21 echo $var
looks like he only takes vars from local and not to execute it from remote
thats the problem why some servers not remote start via ssh -i key ip
command line
any ideas how i can resolv this or other ideas (other programms ?
thank you

Re: ssh does not execute with remote vars...

Quoted text here. Click to load it

The shell expands the variables on the command line before ssh sees
them.  You'll have the same problem with any other program, try:
echo ssh -i key ip.21 echo $var

If you want the variable to be expanded remotely you'll need to escape
the "$" or quote the whole command, eg:

ssh -i key ip.21 echo $var
ssh -i key ip.21 'echo $var'

Darren Tucker (dtucker at
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

Re: ssh does not execute with remote vars...

hmm does not work..same like before with
'echo $var'
echo $var
but the real problem is ...i testet it only cause of my command server will
not execute remotely

here my server command line which works local perfectly....(opens a screen
deattached with this server) , the whole lines are in a .sh file which
permissions are correct.
screen -dmS test /usr/bin/sudo -u test /usr/test/bingame -game

when i try the same over
ssh -i key ip path/

it does nothing , if i do it only with
screen -dmS test in the it works fine....(without startet server)
when i start only the hlds_run server he means i got incorrect game i
think hlds_run is looking not local for game its looking on the remote pc
andere then comes fault....

any ideas?
thank you

Site Timeline