Re: run as different user

From: Colin McKinnon (
Date: 03/05/04

Date: Fri, 05 Mar 2004 22:31:10 +0000 spilled the following:

> David wrote:
>> Ben Measures wrote:
>>> Lol trying to run a mail reader (an X application) as another user.
>>> Alarm bells ringing in my head.
>> I had a similar thought.
> believe it or not this is 100% honest
> I use my box just myself and have different users accounts on it for
> different purposes like different mail and browsing accounts
> this is my idea of enhanced security so I may not be affected by some
> undiscovered leaks and automated hacks

X is designed as a network capable system - your display will not accept
connections from programs without the proper credentials (typically stored
in your .Xauthority file). So to get round this either:

1) copy the .Xauthority file from the home dir of the user logged into the
display to the homedir of the user who is running the application. (NB this
will overwrite the .Xauthority file for the second user - they won't be
able to open any new windows - it is possible to merge xuath files which
avoids this problem).


2) tell your display to not require authentication from the machine where
the program is executing e.g.
        xhost +localhost
This can then be reversed by:
        xhost -localhost

(I assume that you have set the DISPLAY variable before running the program
as the second user?)