How do I keep x11 display after su and sudo?
In order to achieve this, you could manually retrieve X credentials in the su/sudo context by looking up the “xauth list” for the original username and then adding them using “xauth add” to the current context. You can also use a single command in order to achieve this!
How do I set up Xauth?
Set up a display key on the remote machine
- If you are connecting to golgi: Connect to golgi using your favorite SSH program. Run the following command: addxauthkey my.display.machine.edu:0.
- If you are connecting to another UNIX/Linux system: Run the following command: xauth add my.display.machine.edu:0 .
What is Xhost in Linux?
Description. The xhost command adds or deletes host names on the list of machines from which the X Server accepts connections. This command must be run from the machine with the display connection. You can remove a name from the access list by using the -Host parameter.
Can a Sudo user use the X11 tunnel?
The following procedure allows a sudo user to use the ssh based X11 tunnel: 1. Connect the remote host using the -X option with ssh. 2. Now list the coockie set for the current user. 3. Switch to another user account using sudo. Add the cookie from the command output above to the sudo user.
How to run Firefox with Su or sudo?
Using “su” command: Let’s assume that you are connected to a remote server using SSH with username “john” In this session, you want to perform a “su” command in order to become “root” If you run a graphical application in the “su” context, like “firefox” or “xclock”, the following error will occur:
How to keep Firefox X11 display after Su?
In order to make it work, you just have to execute the following command before the “sudo firefox”: sudo xauth add $ (xauth -f ~john/.Xauthority list|tail -1) 2. Using “su” command: Let’s assume that you are connected to a remote server using SSH with username “john”
How to get x credentials in su or sudo?
However, in some cases you may need to start a graphical application like nedit or firefox in a sudo or su context. In order to achieve this, you could manually retrieve X credentials in the su/sudo context by looking up the “xauth list” for the original username and then adding them using “xauth add” to the current context.