LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Run a command on another terminal. (https://www.linuxquestions.org/questions/slackware-14/run-a-command-on-another-terminal-563884/)

mpyusko 06-23-2007 12:33 AM

Run a command on another terminal.
 
Here's the setup:

I ssh into another machine.
I login and a user (not root)
I run startx
When I logout, x closes

I want it to stay open.

For now, I was able to:

ssh into another machine.
Login as root
run kdm
but kdm requires a username and password
(I know I can do automatic logins, but that isn't and option for what I wat to do)

What I'd like to do is execute a command from pts/1 and have it run from tty1.
Ultimately I'd like to run a command from the console and have it wind up on :0 (ie, KDE is up and running and I want to open krfb from the remote console.) Now if I were on the machine locally, I could open konsole, execute krfb, and it would open in the GUI.

Is this even possible?

jschiwal 06-23-2007 02:16 AM

You can run "ssh -X user@host"
Then enter "krfb". The program will come up on your local display even though it is running on the remote machine.

Alternately, you could start a GUI program on the remote machine anyway, so you don't need to share the desktop.

Tinkster 06-23-2007 02:21 AM

You could start screen, and fire up X from there ...


Cheers,
Tink

jschiwal 06-23-2007 03:44 AM

A lot depends on what security settings you have on your network. The traditional methods of having X sessions displayed remotely (i.e DISPLAY=yourhostip:0.0" ) may not work unless you relax the security settings.

Here is a quick & easy ssh based experiment you can try.
On the local machine instead of logging into GDM locally, switch to a virtual terminal. Let's say vt/1.
Now fire up a bare bones X screen on vt/8.
xinit -- '1:0'

Now you will have a blank X screen with xshell running.
In the xshell run:
ssh -X yourusername@remotehost gnome-session &

This will fire up the gnome desktop on the remote machine but have it displayed locally.
The sshd server will handle xauth cookies for you over the ssh tunnel. Of course you can't close xshell or the tunnel will collapse unless you detach xshell or use screen.

----

If it is just a program that you want to run on the remote host but have it display locally, you could run ssh from the application launcher.
ssh -X user@host /opt/kde/bin/konqueror
will launch konqueror. You won't have a konsole that you need to close.


All times are GMT -5. The time now is 01:19 AM.