Link to home
Start Free TrialLog in
Avatar of probine
probine

asked on

How do I run a program in a remote computer with SSH ?

I am able to connect though SSH with a remote computer. Once I am connected, then I can create a new folder in the remote computer, I can also delete the folder in the remote computer, and so on...

I would like to be able to start a program in the remote computer as well. I do not want to see this program in my scree, I just want that program to start running in the remote computer.

How do I do this ?
Avatar of CapTech
CapTech

If the program executible is in your $PATH (echo $PATH), then you can simply type the program name followed by the ampersand.  For example, let's say I wanted to run or start mysqld_safe.  I'd type (this example is done as root):

> # mysqld_safe &

If the program does not reside in any of your $PATH directories, you can change directories to where it is as follows:

> # cd /path/to/directory/

Let's say I'm wanting to start a program named stats, in the /usr/local/stats/bin folder, but /usr/local/stats/bin isn't in my $PATH.  I can:

> # cd /usr/local/stats/bin

Then I can type:

> # ./stats &

Notice the period before the program name.

You can also run the same program directly from your current location by typing:

/usr/local/stats/bin/stats &

Doing it this way, you don't need the preceeding period.

Hope this helps.
Avatar of probine

ASKER

Thanks for the detailed explanation, though it doesn't work in my computer.

Computer A wants to run a program in computer B through SSH. I have looged into computer B, and I am able to create a folder, delete it, even to start and stop services, but:

In computer A I typed:
firefox &

This command did not open firefox in computer B. The only thing it printed in the screen is: [1] 2339

Help !!!
Ah, that's different.  Using ssh, you can start services, but you can't start what would otherwise be a gui program in the background for the remote user to see that way.

When ssh'd in, if you try to load something that is a user level program, the system will try to present it to YOU.  Since you do not have a gui presence with an ssh, and since you have backgrounded it, there really is no place to go with the resulting program, so it just sits there in limbo (zombied).

What exactly is it you are wanting to do?

D
Avatar of probine

ASKER

I just want to be able to start firefox in the remote computer... I do not want to see it, only start it, so the remote user can see it.

The problem I have is that in KDE the "kicker" or menu bar ( where you start the programs, clock, etc...) disappeard in the remote computer, so I want to make it appear again.
I don't believe it's possible for you to remotely open a program that will appear on the end users desktop.  If it is, I've never heard of it.

Regards,

D
Avatar of probine

ASKER

Hi CapTech,

It is not that I do or don't believe on it. It is a question that I would like to solve fro curiosity.

Machine A wans to open firrefox in Machine B. how?
Hi,
have you tried to redirect the display to machine B? What you should type on the shell (on the remote machine) is just the following command:
export DISPLAY=:0
firefox
After doing that, firefox should open on machine B.
ASKER CERTIFIED SOLUTION
Avatar of pjedmond
pjedmond
Flag of United Kingdom of Great Britain and Northern Ireland 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
If your user wants you to be able to connect to them, then there is a variant of vncserver that they can run called:

x0vncserver

which connects their desktop to a vnc server, and means that you can connect to them remotely in order to assist.

(   (()
(`-' _\
 ''  ''