LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-27-2003, 03:56 PM   #1
guygriffiths
Member
 
Registered: Jun 2003
Location: Reading, UK
Distribution: Debian 3.0, LFS
Posts: 524

Rep: Reputation: 37
XServer Connection Problem


I have been having the following problem lately:
When I run an X app under su in a terminal, I get the following error:

Xlib: connection to ":0.0" refused by server
Xlib: Client is not authorized to connect to Server
kedit: cannot connect to X server :0.0

In this case, I tried to run kedit to edit a file without having to log out and back in again as root, but the problem occurs with any program which uses X. I have found in other places that the command xhost +localhost removes this problem temporarily, but I would like to know if it is possible to make it go away for good.

I am running debian, with XFree4 and KDE 3.1
Any help would be most appreciated
Guy
 
Old 07-27-2003, 04:03 PM   #2
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
# Allow root to use X
xhost +local:
su -
export DISPLAY=:0.0
 
Old 07-28-2003, 10:36 AM   #3
guygriffiths
Member
 
Registered: Jun 2003
Location: Reading, UK
Distribution: Debian 3.0, LFS
Posts: 524

Original Poster
Rep: Reputation: 37
Unfortunately this does not work.
Again, it temporarily fixes the problem, but once I restart the X server, it no longer works.
 
Old 07-28-2003, 10:58 AM   #4
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
If you want it to be automatic, put it in your .bashrc, .bash_profile or your .xinitrc or other X init file you might use. Then it activates on log-in.

You have to do root's command in root's .bashrc, IIRC. I think there is a posting about it in the hints thread in my sig.
 
Old 08-01-2003, 08:44 AM   #5
guygriffiths
Member
 
Registered: Jun 2003
Location: Reading, UK
Distribution: Debian 3.0, LFS
Posts: 524

Original Poster
Rep: Reputation: 37
I put roots command in .bashrc, and the other command in my init files, but still it doesn't work. Sorry to be a pain.
 
Old 08-03-2003, 02:54 PM   #6
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
Perhaps debian sources another file rather than the .bashrc in the home directory.

Does it work if you command:

source ./.bashrc
 
Old 08-03-2003, 03:11 PM   #7
Corin
Member
 
Registered: Jul 2003
Location: Jette, Brussels Hoofstedelijk Gewest
Distribution: Debian sid, RedHat 9, Suse 8.2
Posts: 446

Rep: Reputation: 31
If the DISPLAY variable is set to

yourhostname.yourdomain.COM:0.0

rather than just :0,

then you will need to issue the command

xhost + yourhostname.yourdomain.COM

before issuing the su - root command.

If the HOST variable is correctly set to your host name then you can just
do

xhost + $HOST

but note that if HOST is not set, then the above becomes

xhost +

which allows anybody on any machine anywhere who can connect to your machine access to your display.

The xhost + local: only enables non networked local connections from the localhost.

Automatically disabling the access control from the local machine is a BAD thing, since it enables any other user logged in on your machine to mess about with your DISPLAY and even run a program to see your screen and capture keystrokes (including the keys pressed for the root password when you su).

And if you say, "Oh this is on my home machine, and I am the only user" then remember that "Security begins at home" and habits, bad or good, formed there will be transferred to multi user machines in the business place.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
setting-up an xserver connection with remote host through local firewall. qanopus Linux - Security 5 02-02-2006 10:11 AM
xserver-xorg config warning: migrating xserver-xfree86 templates doctorwebbox Debian 9 07-27-2005 07:24 PM
Xserver problem X-men Mandriva 1 05-18-2005 12:57 AM
xserver problem taoweijia Linux - Software 2 07-05-2004 02:34 AM
Xserver Refuse Connection ..:eMa:.. Debian 3 04-14-2004 04:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration