Please support VectorLinux!

Author Topic: HOWTO let root run X programs  (Read 6693 times)

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
HOWTO let root run X programs
« on: September 15, 2006, 07:11:07 pm »
This comes up fairly frequently...long enough for a HOWTO? I guess I'll see

Let's say you want to open an administrative program like gparted, which needs to run as root. You type su -c 'gparted' at the prompt and get a mysterious error about denial of access to root, of all users!

First, run xhost +si:localuser:root under your X session without su, i.e., as a normal user. Then, run your root program with su/sudo. It should work fine. Afterwards, you may want to circumscribe root access again. In this case, do: xhost -si:localuser:root as a normal user.

This process can logically apply to other user accounts, substituting other usernames where root is supplied above (and, yes, su can promote your shell to other users than root; see the manual page for further information)

"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

MikeCindi

  • Tester
  • Vectorian
  • ****
  • Posts: 1073
Re: HOWTO let root run X programs
« Reply #1 on: September 23, 2006, 07:31:44 am »
Another way to do this that I found on the Gentoo site is to add the following line to /etc/profile:

export XAUTHORITY="${HOME}/.Xauthority"

According the the Gentoo site this is only a problem when you logon graphically rather than using startx. I hope I haven't missed the point of hanumizzle's HOW TO.

Mike
The plans of the diligent lead to profit...Pro. 21:5
VL64 7.1b3                                     RLU 486143

saulgoode

  • Vectorite
  • ***
  • Posts: 340
Re: HOWTO let root run X programs
« Reply #2 on: September 23, 2006, 08:49:44 am »
According the the Gentoo site this is only a problem when you logon graphically rather than using startx.

I was wondering why I never experienced this problem: I always (well almost) use 'startx'. Nonetheless, thanks for the instruction.
A complex system that works is invariably found to have evolved from a simple system that works.

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
Re: HOWTO let root run X programs
« Reply #3 on: September 23, 2006, 07:25:52 pm »
Another way to do this that I found on the Gentoo site is to add the following line to /etc/profile:

export XAUTHORITY="${HOME}/.Xauthority"

According the the Gentoo site this is only a problem when you logon graphically rather than using startx. I hope I haven't missed the point of hanumizzle's HOW TO.

Mike

I never ran into such a problem.
"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

MikeCindi

  • Tester
  • Vectorian
  • ****
  • Posts: 1073
Re: HOWTO let root run X programs
« Reply #4 on: September 24, 2006, 06:07:48 am »
I always had this problem (su'ing to root then not being able to run X programs) because I typically would boot directly into the GUI (default VL-SOHO behavior). Then when I would open a console and su to root even glxgears wouldn't run. Since I'm very much new to linux (less than a year of regular use I think) I prefer the GUI vs the CLI when I start up and then will open a console as needed instead of opening a desktop from the command prompt as needed.
Mike
The plans of the diligent lead to profit...Pro. 21:5
VL64 7.1b3                                     RLU 486143

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
Re: HOWTO let root run X programs
« Reply #5 on: September 24, 2006, 09:33:55 pm »
I always had this problem (su'ing to root then not being able to run X programs) because I typically would boot directly into the GUI (default VL-SOHO behavior). Then when I would open a console and su to root even glxgears wouldn't run. Since I'm very much new to linux (less than a year of regular use I think) I prefer the GUI vs the CLI when I start up and then will open a console as needed instead of opening a desktop from the command prompt as needed.
Mike

What I'm saying is: I never had to poke ~/.Xauthority.
"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

MikeCindi

  • Tester
  • Vectorian
  • ****
  • Posts: 1073
Re: HOWTO let root run X programs
« Reply #6 on: September 25, 2006, 01:45:21 am »
I wonder why some would have this problem and others not? After a default, full install of SOHO I would edit fstab, lilo.conf, and xorg.conf (adding the DRI section) which should have no bearing on root's ability to run X programs.
I haven't toyed with dynamite much yet but I'll see what happens with it (probably next week) and come back here (actually probably not in the HOW TO forum).
Mike
The plans of the diligent lead to profit...Pro. 21:5
VL64 7.1b3                                     RLU 486143

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
Re: HOWTO let root run X programs
« Reply #7 on: September 25, 2006, 02:09:30 am »
root is denied access to the X server by default (unless it was Phra Root who started it)

If this is not the case in other distros, they must have it turned on somewhere.
"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

easuter

  • Global Moderator
  • Vectorian
  • *****
  • Posts: 2160
Re: HOWTO let root run X programs
« Reply #8 on: September 25, 2006, 03:23:28 pm »
its also not on in Slackware. Fedora Core and Suse seem to have it on by default.
anyway, the fix appears to be in the latest Dynamite's .bashrc