X11 display forwarding for root








  • The problem:
    [wilson@local-host]$ ssh -Y -A -t -C -o CompressionLevel=9 wilson@remote-host
    [wilson@remote-host]$ sudo su
    [root@remote-host]$ xclock
    X11 connection rejected because of wrong authentication.
    Error: cannot open display: localhost:10.0
    
  • The solution:
    [wilson@local-host]$ ssh -Y -A -t -C -o CompressionLevel=9 wilson@remote-host
    [wilson@remote-host]$ sudo su
    [root@remote-host]$ su - wilson -c 'xauth list' | grep $(echo $DISPLAY | cut -d ':' -f 2 | cut -d '.' -f 1 | sed -e s/^/:/) | xargs -n 3 xauth add
    [root@remote-host]$ xclock
    

See also




No comments:

Post a Comment