?
Solved

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

Posted on 2006-05-23
11
Medium Priority
?
312 Views
Last Modified: 2013-12-16
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 ?
0
Comment
Question by:probine
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 2

Expert Comment

by:CapTech
ID: 16747776
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.
0
 

Author Comment

by:probine
ID: 16749552
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 !!!
0
 
LVL 2

Expert Comment

by:CapTech
ID: 16750346
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
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:probine
ID: 16750810
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.
0
 
LVL 2

Expert Comment

by:CapTech
ID: 16756336
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
0
 

Author Comment

by:probine
ID: 16805950
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?
0
 

Expert Comment

by:ivanorro
ID: 16831814
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.
0
 
LVL 22

Accepted Solution

by:
pjedmond earned 1000 total points
ID: 16840720
In think that I understand what you are trying to do. The problem that you have here is that in order to run Firefox, you must have an X server running providing a suitable environment......so.....on the remote machine run:

vncserver

It will automatically daemonise and run in the background, so you do not need the & already mentioned. You will be asked for a password to allow vnc connections

You can then connect from your local machine using vncclient.

If you want a 'nice' kde or gnome desktop, then you'll need to edit the

~/.vnc/xstartup

before connecting to be:
------------------x8-----------------
#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
------------------x8-----------------

Now start up a remote shell on the remote system, and you can run firefox, or anything else that you want.

Useful bits of info:

1.   To kill a vncserver:

vncserver -kill :1

where 1 is the display number

2.    To check whether firefox exists on the remote computer:

which firefox

should give the path.

3.    Web site for vnc:

http://www.realvnc.com

if you need to download a windows client for it.

Consider that vnc just enables you view what is running in a session on the remote machine. Once you have disconnected, everything carries on running, and you can reconnect and see how far it has got at a later date.

More complex solutions are available, such as NX:

http://www.nomachine.com

if you decide that you really like this concept at a later date.

HTH:)


0
 
LVL 22

Expert Comment

by:pjedmond
ID: 16975801
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.

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question