In order to be able to forward your ssh -X or ssh -Y after doing sudo we need to use Xauth.
-sh-4.2$ ssh -Y mano@server12 -sh-4.2$ xauth list|tail -1 server12.sunwave.es:10 MIT-MAGIC-COOKIE-1 38a81b09365e1b5d13c50ad53d378a78 -sh-4.2$ sudo su [sudo] password for mano: root@server12 mano]# xauth Using authority file /root/.Xauthority xauth> add server12.sunwave.es:10 MIT-MAGIC-COOKIE-1 38a81b09365e1b5d13c50ad53d378a78 xauth> exit Writing authority file /root/.Xauthority [root@server12 mano]# xeyes
Now we can launch GUI as root, and the traffic will be forwarded trough our ssh session.