[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: jessie: unable to run remote graphical program with sudo



 Hi.

On Tue, May 26, 2015 at 01:43:57PM -0600, D. R. Evans wrote:
> I have just installed stable (jessie) on a machine that used to run Kubuntu.
> This machine is mostly accessed remotely, using ssh.
> 
> If I log in as a normal user over ssh, I can run X programs fine. (For
> example, typing "xterm" brings up the expected terminal.)
> 
> However, if I execute "sudo xterm", then I receive the message:
> 
> ----
> 
> n7dr@shack:~$ sudo xterm
> X11 connection rejected because of wrong authentication.
> 
> ----
> 
> What is wrong and how do I fix it so that I can run graphical programs across
> the network using sudo?

sudo strips nearly all environment variables from programs you run via
it. The list of stripped variables includes $DISPLAY and $XAUTHORITY,
and both of those are necessary to run any X client. The default sudo
configuration is perfectly ok, and there's no need to change it. The
reason being - it *very* simple to lower overall system security by
changing nearly anything in /etc/sudoers.

Yet there's a way to solve your problem - get a habit of running
X clients like this:

HOME=/root sudo -E xterm

Re-defining $HOME is crucial as otherwise you risk users' rewriting
configuration files by root.

Reco


Reply to: