Two GUI applications as different users on the same screen
Run the following command to give userBname
access to the display:xhost +SI:localuser:userBname
You may use xhost +
to give access to everybody; however this is insecure. Better is to give access on a per-user basis. The correct syntax for xhosts entries for local users is SI:localuser:username
.
Then su userBname
, export DISPLAY=:0.0
, and finally run your GUI program. Although you granted access to the display earlier with xhost
, you must also set the environmental variable DISPLAY
so that programs know where to place their graphical output. Allowing different DISPLAY
variables for different users allows multiple users connected to a single machine to use different physical terminals.