LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Xlib: connection to ":0.0" refused by server (https://www.linuxquestions.org/questions/linux-software-2/xlib-connection-to-0-0-refused-by-server-331779/)

swan2925 06-09-2005 03:24 AM

Xlib: connection to ":0.0" refused by server
 
I am running SuSE v9.2 FTP DVD version.

Quote:

swan@itscpc178:~> su
Password:
itscpc178:/home/swan # yast2
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

y2controlcenter: cannot connect to X server :0.0
itscpc178:/home/swan # exit
swan@itscpc178:~> /sbin/yast2
What should I config, in order I could run these X programs when I "su"?

I would be very grateful if I could receive your favorable reply.

Thanks!!

rshaw 06-09-2005 08:43 AM

either use 'sux -' instead of 'su' or enter 'xhost +localhost'

m_yates 06-09-2005 08:45 AM

As normal user, you can run:
Code:

xhost local:root
and then root will be able to open x programs. You can edit /root/.bashrc and add the following line:
Code:

export XAUTHORITY=/home/name/.Xauthority
Where "name" is the user account name that you use. After editing /root/.basrc, you won't have to issue the command "xhost local:root" anymore after X starts.

swan2925 06-09-2005 09:39 AM

Thanks very much for you guys kind help!!!

jcconegundes 02-16-2007 08:01 AM

I don't have /root/.bashrc (nor /home/root/.bashrc). I'm using Debian etch. What could I do?

m_yates 02-16-2007 08:11 AM

Are you looking as root user? First "su" to become root. Try this:
Code:

su
nano /root/.bashrc

Do you see any text there from the .bashrc file?

jcconegundes 02-16-2007 09:09 AM

I'm sure.

code:
$su
#cd /root
#ls .bashrc
ls: .bashrc: Arquivo ou diretório não encontrado

The fouth line means: "File or directory not found".

Thanks for the trying.

nx5000 02-16-2007 09:20 AM

Install sux like rshaw said a year ago

jcconegundes 02-16-2007 05:25 PM

Sux is already installed.

Code:

#apt-get install sux
Lendo lista de pacotes... Pronto
Construindo árvore de dependências... Pronto
sux já é a versão mais nova.
0 pacotes atualizados, 0 pacotes novos instalados, 0 a serem removidos e 184 não atualizados.

(in the fourth line apt says that sux is in its newest version)

And when I try:

Code:

# xhost +localhost
I get

Code:

Xlib: connection to ":0.0" refused by server
Xlib: Invalid MIT-MAGIC-COOKIE-1 key
xhost:  unable to open display ":0.0"

and also

Code:

$ xhost +localhost
localhost being added to access control list
$ su
# emacs
Xlib: connection to ":0.0" refused by server
Xlib: Invalid MIT-MAGIC-COOKIE-1 key
emacs: Cannot connect to X server :0.0.
Check the DISPLAY environment variable or use `-d'.
Also use the `xhost' program to verify that it is set to permit
connections from your machine.

The trick wich alway works well, but just till I reboot, is

Code:

cp /home/jcconegundes/.Xauthority /home/root

jcconegundes 02-16-2007 07:23 PM

I added

Code:

export XAUTHORITY=/home/regular_user/.Xauthority
in /etc/profile. And now, it works even if I reboot.

That was not a clean work, I think. Any better sugestion?

kiel2155 05-13-2007 03:31 PM

Quote:

Originally Posted by m_yates
As normal user, you can run:
Code:

xhost local:root
and then root will be able to open x programs. You can edit /root/.bashrc and add the following line:
Code:

export XAUTHORITY=/home/name/.Xauthority
Where "name" is the user account name that you use. After editing /root/.basrc, you won't have to issue the command "xhost local:root" anymore after X starts.

Thanks for the help!

mmodem 07-17-2007 12:16 PM

Quote:

Originally Posted by m_yates
As normal user, you can run:
Code:

xhost local:root
and then root will be able to open x programs. You can edit /root/.bashrc and add the following line:
Code:

export XAUTHORITY=/home/name/.Xauthority
Where "name" is the user account name that you use. After editing /root/.basrc, you won't have to issue the command "xhost local:root" anymore after X starts.

This is only good when running from a shell.

In /etc/profile i do have a line with:
export XAUTHORITY=/home/name/.Xauthority[/CODE]

but when i run konqeror as root (and is runned by clicking in the konquerorsu icon in kmenu), when double clicking in a text file, i get this error:

KDEInit cant launch 'kwrite'.

So i continue to have to run in a console "xhost local:root".

How am i gona solve this permanently? Add "export XAUTHORITY=/home/name/.Xauthority" to /etc/etc/rc.d/rc.local ?

Isnt there a better solution?

mklose 10-24-2007 11:12 AM

Partly Worked
 
Quote:

Originally Posted by kiel2155 (Post 2747363)
Thanks for the help!

Thank you very much for sharing the solution :)
but only the command part worked for me. I have to issue the command every time I start thunderbird.

nx5000 10-24-2007 02:47 PM

Even simpler:
Link to the current correct cookie

$ su -
type your password
# ln -s /home/user/.Xauthority

fitzhugh 11-18-2007 01:20 AM

Quote:

Originally Posted by jcconegundes (Post 2633098)
I don't have /root/.bashrc (nor /home/root/.bashrc). I'm using Debian etch. What could I do?

in case you return to read this and are not yet clear: just add /root/.bashrc
You can create it with just that one line that was suggested for this problem:
Code:

export XAUTHORITY=/home/name/.Xauthority
or you can add other commands, aliases etc. that you might want to have as well. Check out http://www.faqs.org/docs/abs/HTML/files.html for information on what this and the related files do. Basically they are where you configure systemwide [/etc/.bashrc and /etc/.profile] and user-specific [$HOME/.bashrc and $HOME/.bash_profile] functions and aliases (for bash shell only).

This means you, as the administrator of your computer, get to decide what all goes in them. Typically, users would decide what goes in their own $HOME/.bashrc and $HOME/.bash_profile - most likely that is also you. My main point is that they are there for your convenience, rather than being some untouchable and necessarily mysterious file of the "us mortals shall not touch" category.

This link explains more clearly the difference between these different files: http://www.linuxquestions.org/questi...bashrc-273992/

Note: $HOME refers to your home directory, for example it might be /home/kiel2155/.bashrc

Hope this helps.
Fitzhugh


All times are GMT -5. The time now is 04:47 PM.