0

How do I forward X when switching users?

I can ssh -X username@server.example.com and open GUIs just fine. However, then when I sudo su to root, the X11 forwarding seems to stop because the windows never seem to launch.

ssh access is disabled for root, otherwise I would just connect directly.

1 Answers1

1

You would need to set up the magic cookies and the DISPLAY environment variable appropriately. While the latter is done easily, the latter is a bit more complicated. In some cases using insecure forwarding ssh -Y might be a solution, but I generally advise against the X11 over SSH. In most cases it is better to use VNC.

peterph
  • 30,838