When you want to run an interactive program in linux server, and you have logged in through remote shell (with tools like MobaXterm), and you want to use sudo or su command to invoke the interactive program then you may get errors relating to Proxy authorization, when you try to invoke the program

For e.g., you enter the command as shown below

[username@servername ~]$ sudo ./catalogmover.sh

You will receive the following error message

MobaXterm X11: Proxy authorisation not recognised

Steps to resolve this issue

  •  Change to your home director

       [username@servername ~]$ cd ~

  • Run the following command

      [username@servername ~]$ xauth list

This command will list down the session ids as shown below

<ServerName>/unix:11 MIT MAGIC   COOKIE   1 1652db51d8a3a6e1fc837491a706d194

<ServerName>/unix:10 MIT MAGIC   COOKIE 1 2df6b584ff6448924900165ae51a7589

  • Copy the last line from the above results and add to the command sudo xauth add as shown below to add the session id to the authorization list

[username@servername ~]$ sudo xauth add <ServerName>/unix:10 MIT MAGIC COOKIE   1 2df6b584ff6448924900165ae51a7589

If you did not receive any error message, then the operation is successful.

  • Now try to run the actual command you were trying to invoke

[username@servername ~]$ sudo ./catalogmover.sh

You should see the user interface for the command coming up.

Remember the .Xauthority file is a hidden file, and so if you check for the file with simple ls -ltr command it will not be listed.

So you should use a command as shown below to check if the file is present.

[username@servername ~]$ ls – ltr .Xauthority

Also, if the file is not present, copy the file from the root directory, and then change the permissions and ownership for the file.

[username@servername ~]$ sudo cp – p /root/.Xauthority ./

[username@servername ~]$ sudo chmod 600 .Xauthority

[username@servername ~]$ sudo chown <username> .Xauthority

(In the above command <username> is your user-id )

Hope this helps. Happy linuxing !!!