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

Re: sudo and X



Simo Kauppi wrote:
On Wed, Jan 25, 2006 at 04:17:20PM -0500, Michael Papazoglou wrote:
There has been some discussion about sudo and X, but I have yet to
see a solution.

The problem is, with the latest update to sudo, when I try to use sudo
to run a program that opens a window (example: sudo xterm) I get
the error:

xterm: DISPLAY is not set

So I wrote the following script:

#!/bin/bash
echo DISPLAY is $DISPLAY

When I run it using sudo before the sudo update, the output is:

DISPLAY is localhost:11.0

when I run it using sudo after the update, I get:

DISPLAY is

Can I do something to force sudo to set the DISPLAY variable?  I've seen
the suggested solution to use sux, but with sux, the user has to know the
root password, right?

Any help would be appreciated...

Mike

I haven't seen any definitive answers to this one yet and I'm not sure
if the behavior is different between sarge and etch (I have etch).

After the update of sudo I didn't have any problems, but as soon as I
put the "Defaults env_reset" into the /etc/sudoers as suggested by the
DSA 946-1, the sudo environment was limited to the few variables.
DISPLAY is not one the those variables.

According to the DSA, additional variables are only passed through when
set as env_check in /etc/sudoers, but I haven't got it working. I.e.

Defaults env_reset
Defaults env_check += DISPLAY

doesn't work for me.

So, until somebody comes up with the correct way of doing this, I use
env_keep to pass the needed variables to sudo:

Defaults env_reset
Defaults env_keep = "DISPLAY"

in my /etc/sudoers.

Simo

Thanks Simo.
I was using Preferences to keep sudo_1.6.8p7-1.3 back.
This is better.

H





Reply to: