Writing bash script for X-11 forwarding
- by Bruce
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?