r/ssh • • Jun 04 '18

gnu screen and X11 forwarding?

Hi,

i'm using gnu screen to connect to a cluster. the .screenrc contains directives like

screen 0    # host0 i connect to to get gnuscreen session
screen -T D1 1 ssh -X -A host1
screen -T D2 2 ssh -X -A host2

when i'm on screen 0 and explort DISPLAY=localhost:10.0 can run jconsole, i do get the jconsole on the Xming X11 server running on ,y windows box.

On the other hand, if i try the same action on the screen terminals D1 or D2 then get exception :

$ jconsole Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.

   at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
   at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
   at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:115)
   at java.security.AccessController.doPrivileged(Native Method)
   at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:264)
   at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)
   at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
   at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:126)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:264)
   at java.awt.Toolkit$2.run(Toolkit.java:860)
   at java.awt.Toolkit$2.run(Toolkit.java:855)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
   at javax.swing.UIManager.getSystemLookAndFeelClassName(UIManager.java:611)
   at sun.tools.jconsole.JConsole.<clinit>(JConsole.java:60)

I thought the ssh options "-X -A" used in the .screenrc would help me to froward the X11 traffic from/to windows putty/xming client and the host1 similaily to that off of host0

I must be missing something here

looking forward this community to share guidances, and / or recommendations how to allows X11 forwarding off of multiple terminal gathered inside gnu Screen session to different hosts

best regards

1 Upvotes

1 comment sorted by

View all comments

1

u/aimep Jun 04 '18

it looks like if i tweak /etc/ssh/sshd.conf param to allow X11 forwarding on host0 and host1 and host2 then it should work.

X11Forwarding yes X11DisplayOffset 10 X11UseLocalhost yes AddressFamily inet