Are you a spammer

Please note, that the first 3 posts you make, will need to be approved by a forum Administrator or Moderator before they are publicly viewable.
Each application to join this forum is checked at the Stop Forum Spam website. If the email or IP address appears there when checked, you will not be allowed to join this forum.
If you get past this check and post spam on this forum, your posts will be immediately deleted and your account inactivated.You will then be banned and your IP will be submitted to your ISP, notifying them of your spamming. So your spam links will only be seen for an hour or two at most. In other words, don't waste your time and ours.

This forum is for the use and enjoyment of the members and visitors looking to learn about and share information regarding the topics listed. It is not a free-for-all advertising venue. Your time would be better spent pursuing legitimate avenues of promoting your websites.

How I broke and fixed Xauthority (permissions hell2)

Help & support for Ultimate Edition 1.7


How I broke and fixed Xauthority (permissions hell2)

Postby dcorleone » Sat Feb 02, 2008 1:03 am

So after the kdesu/gksu/GDM/KDM debacle, I'm back in business... The desktop's working right again, my kdesu's working... But there's one symptom left-over... Now, if I'm in a terminal and I su to root and try to run any X-based app which I often do, I might su then do a kedit /etc/X11/xorg.conf for example. Perfectly routine before the KDM/GDM nightmare, but now I get this:

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

kedit: cannot connect to X server :0.0

This one took quite a bit of web-surfing to resolve. I'm no linux-expert, I know just enough to get myself into trouble, so what I THINK happened was that the Xauthority got broken. When you're in a terminal as a regular user, you get a "cookie" that gives you permission to connect to the X-server and run grapical apps. Then when you su to become root, that cookie gets passed from your normal account to your temporary-root account. (I THINK) Somehow that connection that passes the cookie from normal to root got broken, so when I became root, I didn't have the Xauthority cookie I need to connect to the Xserver anymore.

I searched far and wide for a way to fix this, and NOBODY could come up with an answer. That connection was broken and there's not a linux-gnome on earth that knew how to fix it. There WERE a couple work-arounds tho. The first was cumbersome. Every time you want to su, you type this first:

xhost local:root

That'll give root that cookie, but you have to do it every time. The next solution was much more painless, but pretty scary. If you do a:

xhost +

at the command prompt, that will turn off the security/cookie mechanism so that ANYBODY can connect to the Xserver. No cookies required. That just screams security risk tho. The last one was the best fix and pretty damned close to the way things are SUPPOSED to run anyway.

That was to edit /root/.bashrc and add:

export XAUTHORITY=/home/name/.Xauthority

To the end of the file. ("name" being the name of my normal account, oc) Bashrc is what gets run whenever root starts a bash (shell) session. That sets it so that whenever root starts a session, it'll use the .Xauthority cookie from my normal account to get permission to launch x programs. And this is more or less the way it was designed. Instead of getting the cookie passed automatically, it gets it directly. This still isn't really a FIX, cuz something's obviously still broken, but since this workaround pretty much recreates the stuff that's broken anyway, it's a safe and simple way to get things back in gear again.

Neither of these things may ever be an issue for anybody else here, but as a relative n00bie myself, I can say it was a big pain in the ass to fix, so I thought I should post this stuff here just in case. Maybe it'll help somebody else untangle a mess like this a lot easier than it'd be without it.
dcorleone
U.E. Knowledgable
U.E. Knowledgable
 
Posts: 33
Joined: Tue Jan 29, 2008 8:17 am
Operating System: Ultimate Edition 3.2 32 BIT



Re: How I broke and fixed Xauthority (permissions hell2)

Postby DaddyX3 » Sat Feb 02, 2008 11:53 am

Thanks for coming back and editing the title - makes things a little clearer.
Intel Core 2 Quad Q9300 2.5GHz 45nm/Gigabyte EP35C-DS3R M.B. w/ddr3 1333
G.Skill 2X1GB DDR3 1333MHz/Gigabyte 8800GT PCIe 2.0 512MB GDDR3 OC'd to 700Mhz/ WD160 gig, 2- WD250 gig in RAID-0 (500GB), WD640 gig e-SATA external

AMD 64 X2 3800+/ASUS A8N32-SLI Deluxe/G.Skill 2X1GB Matched Pair ddr400
/EVGA 6800GS Nvidia Graphics 256MB/WD160gig drive

HTPC Box:AMD 64 X2 4400+/ BIOSTAR TF7050PV HDMI MicroATX/G.Skill 2X1GB /Matched Pair DDR800/Integrated video and audio/WD160gig drive
User avatar
DaddyX3
U.E. God
U.E. God
 
Posts: 2407
Joined: Wed Oct 17, 2007 9:22 am
Location: Central Coast - California
Age: 49
Operating System: Ultimate Edition 2.3 32 BIT



Re: How I broke and fixed Xauthority (permissions hell2)

Postby TheeMahn » Mon Feb 04, 2008 12:30 pm

dcorleone wrote:So after the kdesu/gksu/GDM/KDM debacle, I'm back in business... The desktop's working right again, my kdesu's working... But there's one symptom left-over... Now, if I'm in a terminal and I su to root and try to run any X-based app which I often do, I might su then do a kedit /etc/X11/xorg.conf for example. Perfectly routine before the KDM/GDM nightmare, but now I get this:

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

kedit: cannot connect to X server :0.0

This one took quite a bit of web-surfing to resolve. I'm no linux-expert, I know just enough to get myself into trouble, so what I THINK happened was that the Xauthority got broken. When you're in a terminal as a regular user, you get a "cookie" that gives you permission to connect to the X-server and run grapical apps. Then when you su to become root, that cookie gets passed from your normal account to your temporary-root account. (I THINK) Somehow that connection that passes the cookie from normal to root got broken, so when I became root, I didn't have the Xauthority cookie I need to connect to the Xserver anymore.

I searched far and wide for a way to fix this, and NOBODY could come up with an answer. That connection was broken and there's not a linux-gnome on earth that knew how to fix it. There WERE a couple work-arounds tho. The first was cumbersome. Every time you want to su, you type this first:

xhost local:root

That'll give root that cookie, but you have to do it every time. The next solution was much more painless, but pretty scary. If you do a:

xhost +

at the command prompt, that will turn off the security/cookie mechanism so that ANYBODY can connect to the Xserver. No cookies required. That just screams security risk tho. The last one was the best fix and pretty damned close to the way things are SUPPOSED to run anyway.

That was to edit /root/.bashrc and add:

export XAUTHORITY=/home/name/.Xauthority

To the end of the file. ("name" being the name of my normal account, oc) Bashrc is what gets run whenever root starts a bash (shell) session. That sets it so that whenever root starts a session, it'll use the .Xauthority cookie from my normal account to get permission to launch x programs. And this is more or less the way it was designed. Instead of getting the cookie passed automatically, it gets it directly. This still isn't really a FIX, cuz something's obviously still broken, but since this workaround pretty much recreates the stuff that's broken anyway, it's a safe and simple way to get things back in gear again.

Neither of these things may ever be an issue for anybody else here, but as a relative n00bie myself, I can say it was a big pain in the ass to fix, so I thought I should post this stuff here just in case. Maybe it'll help somebody else untangle a mess like this a lot easier than it'd be without it.


Why su when there is sudo is the first question I must ask? sudo was invented / made to make it so these head aches dont exist. I have spoken with you before and you are not used to the way things work in ubuntu, even though you are a avid user of many other *nix's I would suggest a look at a beginners guide to ubuntu, I am not trying to slam you & know you to be knowledgeable, but things are different in Ubuntu, I hope I have not upset you.

TheeMahn
Home of Ultimate Edition. Got a question? Please review the F.A.Q. Browse the How to section.

Main O/S: Builder of O/S Guess.
Mainboard: ASUS Hero VI (AM4)
CPU: AMD 1700X water cooled (Deepcool Captain Genome Cooling tower)
Ram: 16 GB GSkill Trident RGB Series Dual Channel DDR4 3200
Video: MSI RX470 8GB Gaming card.
Hard Disks: MASSIVE on the network.(10 Gigabit, 48 port, multiple servers)
Monitors: Dual 4K 43" LG, 4K Samsung 28"
750 Watt modular PSU (Rosswell)
1100 Watt Amp & 4 X 600 Watt speakers

Servers in the basement.
User avatar
TheeMahn
Site Admin
 
Posts: 4201
Joined: Fri Oct 12, 2007 10:02 am
Location: U.S.A.
Age: 53
Operating System: Ultimate Edition Developer



Re: How I broke and fixed Xauthority (permissions hell2)

Postby dcorleone » Mon Feb 04, 2008 8:05 pm

Oh I know how to sudo too, but it has a different impact on ownership and permissions stuff than running stuff as su. I use kdseu or sudo most of the time, but I also need to have a root terminal open too. Besides, the whole debacle was an excuse to learn a lot of stuff long the way. You don't learn anything when things work RIGHT... ;-) I mean really sudo and kdesu and gksu are just half-assed work-arounds themselves.

To be honest, I haven't had a chance to read much of anything yet. Got my desktop up and running, FINALLY got the software assortment figured out, got things organized and usable. That was the first thing. Now I'm FINALLY done with all that, so I can start learning the ins and outs in a little more depth now.

I know I'm not alone with this situation. There's tons of posts about exactly this. There's lots of ways to work AROUND it, so it's mostly just a matter of curiosity about what happened to make it do that more than anything. And I figured somebody else might bump into this situation too, so thought it might be a good idea to "blog" about it, so to speak.

Good distro. I've run outa bugs that I DIDN'T make myself to nitpick about... I gotta make some of my own to keep it fun. ;)
dcorleone
U.E. Knowledgable
U.E. Knowledgable
 
Posts: 33
Joined: Tue Jan 29, 2008 8:17 am
Operating System: Ultimate Edition 3.2 32 BIT


Return to Ultimate Edition 1.7

Who is online

Users browsing this forum: FaceBook [Linkcheck] and 4 guests