Ssh xterm x11 applications

hi
i’v been doing some reading about xterm most of the info i can find is rather old, but from my reading i should be able to ssh from um 16.04 pc into another um 16.04 pc over a local network and run x11 applications . is this possible ?

i have ssh and rsa keys set up , but when it comes to DISPLAY= ??? :0.0
when i use the below line :
xterm -e ssh [email protected] DISPLAY=192.168.1.43:0.0
an xterm window opens and closes right back down.
thanks in advance for advice or direction

Unless your just wanting to use xterm, it would be easier to accomplish your goal by using mate-terminal. If you have ssh setup on both machines, then all you need to do is enter the following into mate-terminal.

ssh [email protected]

Where username is the name of the user your going to login as on the remote machine, and 192.168.1.43 is the ip address of the remote machine your logging into.

If you have enabled the firewall on one or both machines and the above does not work, turn the firewall(s) off and try again.

Edit: please define “run x11 applications”.

Try ssh -X user@remote On the remote, type xclock, if you see the clock, X11 is being forwarded. Also, on the remote you can type echo $DISPLAY and it will give you the display info.
man ssh and look for the -X and -Y flags.

2 Likes

hi steven & pavlos_kairis
ssh -X user@remote worked with caja , but trying to open a .py it rebelled lol

klein@LG-GX280:~/.config/caja/scripts$ ./g_network
Traceback (most recent call last):
File “network_button.py”, line 724, in
network_places().mainloop()
File “network_button.py”, line 11, in init
Frame.init(self, name=name)
File “/usr/lib/python2.7/lib-tk/ttk.py”, line 738, in init
Widget.init(self, master, “ttk::frame”, kw)
File “/usr/lib/python2.7/lib-tk/ttk.py”, line 551, in init
master = setup_master(master)
File “/usr/lib/python2.7/lib-tk/ttk.py”, line 354, in setup_master
master = Tkinter._default_root or Tkinter.Tk()
File “/usr/lib/python2.7/lib-tk/Tkinter.py”, line 1818, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

and echo $DISPLAY gives me a blank line :
klein@LG-GX280:~$ echo $DISPLAY
created a blank line
klein@LG-GX280:~$

then i tried opening caja again and got:
klein@LG-GX280:~$ caja
Could not parse arguments: Cannot open display:

rebooted

klein@LG-GX280:~$ echo $DISPLAY
created a blank line
klein@LG-GX280:~$

klein@LG-GX280:~$ caja
Could not parse arguments: Cannot open display:

i first tried this after reading your post from a um 16.04 pc connected wifi into my network and
i believe it displayed :10.0 but now on my wired network it is only displaying a blank line,
xclock from wifi worked , from wired net work i get:
klein@LG-GX280:~$ xclock
Error: Can’t open display:

i’m thinking i need to pass the display to ssh ?

The py file is made with python 2 or 3? If its 3 open with $ python3 x.py (where x its the file name)

hi
i took my lunch and tried the wifi pc again and xclock worked and x.py file opened with out any problems, so i’m thinking it something going on in the pc i ssh from and not to pc i’m ssh into.

actually g_network is an bash sh file that looks like this :

#!/bin/bash
cd ~/.my_tools/net_work
python network_button.py
exit 0

so i went to yet another um 16.04 wired pc , updated it. i changed it from static ip to dhcp rebooted and still the same thing .

you should be able to run xclock either host->remote or remote->host after ssh.
from host: ssh -X user@remote, then run xclock … from remote: ssh -X user@host, then run xclock
As for python, I saw in your first post tk stuff … maybe env variables need to be set in your script?

thank you pavlos_kairis
Shebang:
#! /usr/bin/env python

i was doing :
ssh -x user@remote

when i should of been doing :
ssh -X user@remote

Solve thank you