Writing bash script for X-11 forwarding
        Posted  
        
            by 
                Bruce
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Bruce
        
        
        
        Published on 2012-01-18T20:19:10Z
        Indexed on 
            2012/11/19
            17:00 UTC
        
        
        Read the original article
        Hit count: 261
        
I was having problem with SSH X-11 forwarding while I used sudo. I found a solution for it.
$hostname
server4.a.b.edu
First I do:
$ echo $DISPLAY
localhost:10.0
then
$ xauth list
server1.a.b.edu/unix:12  MIT-MAGIC-COOKIE-1  6026864294a0e081ac452e8740bcd0fe
server4.a.b.edu/unix:10  MIT-MAGIC-COOKIE-1  f01fbfe0c0d68e30b45afe3829b27e58
Then I need to do
$ sudo xauth add server4.a.b.edu/unix:10  MIT-MAGIC-COOKIE-1  f01fbfe0c0d68e30b45afe3829b27e58
for sudo to work, for the cookie with my server name and display.
How do I write a bash script to automate this?
© Stack Overflow or respective owner