The xauth program has quite advanced functions for combinig X authority files, but we will only look at the two basic functions.
To list all magic cookies, we can use xauth's list command:
$xauth list einstein:0 MIT-MAGIC-COOKIE-1 4db7c821fc255ba49a7213aa77f7db58 asti:0 MIT-MAGIC-COOKIE-1 4db7c821fc255ba49a7213aa77f7db58 nietzsche:0 MIT-MAGIC-COOKIE-1 4db7c821fc255ba49a7213aa77f7db58 einstein/unix:0 MIT-MAGIC-COOKIE-1 4db7c821fc255ba49a7213aa77f7db58 pg3.cs.rhbnc.ac.uk:0 MIT-MAGIC-COOKIE-1 d563b7dc040abdb0ac4ee90ab81c2cfb $
Usually the first computer is the last one added to the top of the list. It is added when logging in. To find out properly which display we are using we can check the DISPLAY environment variable:
$export | grep DISPLAY declare -x DISPLAY="einstein:0.0" $
Now we can telnet to the other computer and give it the magic cookie:
$telnet platon Trying 134.219.96.1... Connected to platon. Escape character is '^]'. Digital UNIX (platon.cs.rhbnc.ac.uk) (ttypc) login: markst Password: You have mail. alpha $ xauth add einstein:0 MIT-MAGIC-COOKIE-1 4db7c821fc255ba49a7213aa77f7db58 $
We have now enabled access from the other computer, but we can still not use the remote computer's programs.