Bug 5194 - 2_b2: cannot connect to X server :0.0 with sudo su - root in runlevel5
Summary: 2_b2: cannot connect to X server :0.0 with sudo su - root in runlevel5
Status: RESOLVED OLD
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 3
Hardware: i586 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Mageia Bug Squad
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-02 06:23 CEST by Bit Twister
Modified: 2015-03-31 16:06 CEST (History)
3 users (show)

See Also:
Source RPM: kdebase4-runtime-4.8.1-3.mga2.src.rpm
CVE:
Status comment:


Attachments
My test setup/steps/results (1.24 KB, text/plain)
2012-04-02 06:24 CEST, Bit Twister
Details
re-test with xeyes and requested msec settings (2.24 KB, text/plain)
2012-04-02 17:02 CEST, Bit Twister
Details

Description Bit Twister 2012-04-02 06:23:04 CEST
Description of problem:

cannot connect to X server :0.0 with "sudo su - root" in runlevel5 with any X application like kwrite, xterm, xeyes,.....

Version-Release number of selected component (if applicable):


How reproducible: Always


Steps to Reproduce:
1. As a user, click up a terminal
2. su - root
      and create "/etc/sudoers.d/sudo_sys_owner"  with
Host_Alias    CSNETS = 192.168.1.0/24
User_Alias    FULLTIMERS = bittwister
Cmnd_Alias    SU = /usr/bin/su
FULLTIMERS    ALL = NOPASSWD: ALL

      Change  192.168.1.0/24 and bittwister to match your setup
      and set privs with

3. chmod 440 /etc/sudoers.d/sudo_sys_owner
4. exit

    You should be back in your user account
5. sudo su - root
     should provide you with the root prompt, if not, log out/in
     and try sudo command again.

Now for the test, at the root prompt

6. touch del_me
7. kwrite del_me

   If you are in runlevel5 it should fail.
   If runlevel is 3 kwrite should pop up.

8 Switch runlevels, log in. If runlevel3, enter startx
   click up the terminal and do a

9. sudo su - root
10. kwrite del_me

See attachment if test procedure does not work for you.
Comment 1 Bit Twister 2012-04-02 06:24:41 CEST
Created attachment 1900 [details]
My test setup/steps/results
Comment 2 Colin Guthrie 2012-04-02 10:15:20 CEST
Just tried this on my system (I already had a sudo rule in place for me so I skipped that part - hopefully it doesn't have any bearing).

Anyway:

[colin@jimmy ~]$ xprop -root | grep PULSE_ID
PULSE_ID(STRING) = "603@6cb2a4b2bd6df042e57da8a4000001d4/4423"
[colin@jimmy ~]$ sudo su - root
[root@jimmy ~]# xprop -root | grep PULSE_ID
PULSE_ID(STRING) = "603@6cb2a4b2bd6df042e57da8a4000001d4/4423"


So as you can see I can still happily access my users X11.

I did also run xeyes and it worked fine.

Anyway, I'm about to try and reset the suders file to see whether it is simple config of sudo that is to blame. I'll report back in a mo'

CC: (none) => mageia

Comment 3 Colin Guthrie 2012-04-02 10:19:06 CEST
Checked with a clean /etc/suders and a file dropped in suders.d just as you describe.

It all worked fine.

So I simply cannot reproduce here. What msec security level do you have? Perhaps it's getting in the way?
Comment 4 Bit Twister 2012-04-02 17:02:16 CEST
Created attachment 1904 [details]
re-test with xeyes and requested msec settings
Comment 5 Colin Guthrie 2012-04-02 17:18:08 CEST
OK, so maybe it's not related to msec...

What about $XAUTHORITY env var?

[colin@jimmy ~]$ echo $XAUTHORITY 
/var/run/gdm/auth-for-colin-LjSec3/database
[colin@jimmy ~]$ xauth list
jimmy/unix:0  MIT-MAGIC-COOKIE-1  aaaaabbbbbbbcccccccdddddddeeeeef
[colin@jimmy ~]$ sudo su - root
[root@jimmy ~]# echo $XAUTHORITY 
/root/.xauth01jE5y
[root@jimmy ~]# xauth list
jimmy/unix:0  MIT-MAGIC-COOKIE-1  aaaaabbbbbbbcccccccdddddddeeeeef


(value changed to protect the innocent, but it's the same value ultimately).

What says yours?
Comment 6 Bit Twister 2012-04-02 22:16:55 CEST
Hmmm, looking like you are running gnome. Running default install kde here.

[junk@cauldron1 ~]$  echo $XAUTHORITY 

[junk@cauldron1 ~]$  xauth list
cauldron1.home.test:0  MIT-MAGIC-COOKIE-1  47d...
cauldron1.home.test:0  MIT-MAGIC-COOKIE-1  47d2....
cauldron1.home.test/unix:0  MIT-MAGIC-COOKIE-1  47d2....
cauldron.home.test/unix:0  MIT-MAGIC-COOKIE-1  19fc...
[junk@cauldron1 ~]$ sudo su - root
[root@cauldron1 ~]# echo $XAUTHORITY 

[root@cauldron1 ~]#  xauth list
xauth:  file /root/.Xauthority does not exist
[root@cauldron1 ~]# 

All are terminals are xterm. launched from:
1.  ~/.kde4/Autostart/startup
2. desktop shortcut
3. run command via right desktop click
and tried a konsole.

$XAUTHORITY is blank
Comment 7 Colin Guthrie 2012-04-02 22:21:08 CEST
Looks to me like a KDM/KDE init error then. I guess some work is needed to bring it up to speed.

A quick test would be to use gdm as a DM but still log into KDE and see if the problem persists. At least then it would easier to see where to start looking in order to fix.
Bit Twister 2012-04-03 01:28:04 CEST

Source RPM: (none) => kdebase4-runtime-4.8.1-3.mga2.src.rpm

Comment 8 Bit Twister 2012-04-03 04:32:43 CEST
Problem workaround solution:
1. urpmi --auto gdm

2. change DISPLAYMANAGER=gdm in /etc/sysconfig/desktop
3. reboot

I tested with
xterm -fg white -bg darkblue -e "sudo su - root" &
xterm -fg white -bg Seagreen &
Comment 9 Marja Van Waes 2012-05-26 13:09:34 CEST
Hi,

This bug was filed against cauldron, but we do not have cauldron at the moment.

Please report whether this bug is still valid for Mageia 2.

Thanks :)

Cheers,
marja

Keywords: (none) => NEEDINFO

Comment 10 Bit Twister 2012-05-26 15:59:27 CEST
(In reply to comment #9)

> 
> Please report whether this bug is still valid for Mageia 2.

still valid.

Keywords: NEEDINFO => (none)

Comment 11 John Smith 2013-08-01 23:40:22 CEST
With a new install of Mageia 3 KDE, and with Sudo installed & working, I cannot run Dolphin or Kwrite as root (the only 2 I've tried) it producing the same error as in the opening post. 'su -c' doesn't work either. It's a bit disheartening to see a year and a version on, that the same bug exists.

Version: Cauldron => 3
Hardware: All => i586
CC: (none) => omelette

Comment 12 Colin Guthrie 2013-08-01 23:53:34 CEST
This is a DM issue. I suspect it's kdm and kdm sucks hugely. As mentioned above gdm behaves much better and I hope we can drop kdm soon for something better (e.g. ssdm) as the default KDE/Qt DM and get rid of these issues once and for all.
Bit Twister 2014-01-18 16:43:14 CET

CC: (none) => junknospam

Comment 13 Marja Van Waes 2015-03-31 16:06:04 CEST
Mageia 3 changed to end-of-life (EOL) status 4 months ago.
http://blog.mageia.org/en/2014/11/26/lets-say-goodbye-to-mageia-3/ 

Mageia 3 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of Mageia
please feel free to click on "Version" change it against that version of Mageia
and reopen this bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

--
The Mageia Bugsquad

Status: NEW => RESOLVED
Resolution: (none) => OLD


Note You need to log in before you can comment on or make changes to this bug.