Link to home
Start Free TrialLog in
Avatar of probine
probine

asked on

How do I run a program in a remote computer ?

I have 2 computers: A and B.

Computer A is used to login into computer B through SSH.

Now, I would like to run a program in computer B, lets say firefox. I am already logged into computer B from computer A, so I can for example type: "mkdir aDir", or "kill 2558", and so on... all those commands work fine.

Conclusion: after a successfull login with SSH, in a console from computer A I can execute commands that take effect in computer B.

THE QUESTION:
How can I start a program in computer B from computer A ???
Avatar of ravenpl
ravenpl
Flag of Poland image

same way as mkdir etc.
After You log in from A to B with ssh, any command You issue takes place on computer B.
But if You want use graphical applications, then login with
ssh -X [more options]
-X tells ssh to forward Xserver connection.

> How can I start a program in computer B from computer A ???
You do that. Or You want do it without using ssh, or without using password?
Avatar of kfullarton
kfullarton

What program are you attempting to start?  Are you connecting from a Linux box or Windows box?
Avatar of probine

ASKER

I am using 2 Linux machines.

I want to start firefox.

I do not want to display the program in my computer, I want top open firefox in the remote computer.
> I do not want to display the program in my computer, I want top open firefox in the remote computer.
Oh, You want to run firefox and You want to display it on remote screen.
In short - this is security issue(as You want to display on not owned screen) and it's impossible, but

if You sure the remote Xserver is started
export DISPLAY=:0
#steal authentication info, eg:
cp -av ~user_which_started_x/.Xauthority ~/
firefox
Avatar of probine

ASKER

ravenpl, can you explain this code :

#steal authentication info, eg:
cp -av ~user_which_started_x/.Xauthority ~/
firefox
Xserver will refuse connection to itself unless it's set to accept any connection(rare ocasion) or You steal authentication info.
The info (magic cookie) is usually stored in ~/.Xauthority file of the user which started the X server
Avatar of probine

ASKER

Hi ravenpl ,

I don't see the logic on your code. I have tried:
cp -av ~user_which_started_x/.Xauthority ~/

and I get thist:
cp: `/home/testUser/.Xauthority' and `/home/testUser/.Xauthority' are the same file



OK, let me ask. How do You know remote box has the Xserver started?
You can't (normally) do that from ssh session, as You are not owner of the console...
Avatar of probine

ASKER

Well, in this case I am the one that installed both computer with Linux. I am the one that installed KDE in both of them and  I am the one in control of both computer.

So I know that they both have X installed.

Your code is quite extrange... "cp -av ~user_which_started_x/.Xauthority ~/". It seems that this code doesn't copy anything in the remote machine, it only copies the same think in the same computer.
ASKER CERTIFIED SOLUTION
Avatar of ravenpl
ravenpl
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial