LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 03-06-2008, 04:55 AM   #1
rajnivanza
LQ Newbie
 
Registered: Mar 2008
Posts: 3

Rep: Reputation: 0
Question anybody familiar with this error "Xlib: connection to ":0.0" refused by server" ?


hi everybody,

i have problem regarding KDE environment.
i want to open gedit/kwrite application through program from one linux machine to another linux machine.
its work well when login user as "root" but when login user as "normal user" then display error.

I have written given below code:

cCommand = "gedit" / "kwrite"
uname = "/root" / "/home/rajni"

int executeCommand( char *cCommand )
{
char *uname = malloc (sizeof(char) * UNAME_MAX);
if(homeDir(uname) == FAILURE) {
free( uname );
setError( FNAME, "[Error] : homeDir() failed\n" );
return FAILURE;
}

pid_t pid=fork(); //don't know how vfork and environ works together.
if(pid==-1)
{
setError(FNAME,"fork failed. executeCommand()\n");
return FAILURE;
}
else if(pid == 0) //child
{
setenv("HOME",uname,1); //proper solutions pending. see ~/.Xauthority, xauth etc.
setenv("DISPLAY",":0.0",1);
free( uname );
exit(system(cCommand)); //beware of: return(system(cCommand));
}
else //parent
{
sleep(1); //let the child run first
int status;
if (waitpid (pid, &status, WNOHANG) == pid)
if (WIFEXITED (status) && WEXITSTATUS (status) == 32512) //system() returns this on
//system(unexistsing_bin);
{
char msg[100];
sprintf(msg,"unable to execute %s. executeComamnd()\n",cCommand);
setError (FNAME,msg); //not working. debug it.
return FAILURE;
}
}
return SUCCESS;
}

we get right username path and display error as :
->Xlib: connection to ":0.0" refused by server
->Xlib: No protocol specified

and so,it can't execute the "gedit" / "kwrite" Xcommand successful.

Why is this happening, and how do I fix it?

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

Thanks!!

Last edited by rajnivanza; 03-06-2008 at 07:04 AM. Reason: show the written code
 
Old 03-06-2008, 06:01 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
yes plenty. if you'd searched this site you'd have seen well over 100 identical questions - some of which shown at the bottom of this very page...

run "xhost +" to let any user anywhere open programs on your local x server. or fine tune for better security.
 
Old 03-14-2008, 07:12 AM   #3
Sm1ler
Member
 
Registered: Apr 2004
Location: UK
Distribution: Fedora Core (all), Knoppix, RHEL, Centos, Debian
Posts: 100

Rep: Reputation: 16
Why not try ssh -o ForwardX11=yes user@host Then simply run gedit & Works fine for me is simple and doesn't require any further config.
 
Old 03-22-2009, 06:10 PM   #4
Elinornrond
LQ Newbie
 
Registered: Mar 2009
Posts: 1

Rep: Reputation: Disabled
X-forward using xauth on RHEL5 and Oracle Enterprise Linux 5

Or you can use a secure option through xauth.

(Oracle RHEL5u3)
Modify /etc/gdm/gdm.conf and set DisallowTCP=False (defaults to True) on the receiving server to allow display receipt over TCP.

Restart gdm

Add the X-server on which you wish to see your xclock, xterm or gedit to the .Xauthority-file on the target host:

xauth extract - <receiving host>:0 | ssh <target host> xauth merge -

The <receiving host> must be known to both hosts. If you have more than one subnet be careful which 'display' you add to the .Xauthority-file.

-- See also: man xauth --

Last edited by Elinornrond; 03-22-2009 at 06:11 PM.
 
  


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
Xlib: connection to ":0.0" refused by server Xlib: No protocol specified eyalkz Linux - Newbie 10 02-07-2014 01:53 AM
XERROR: 'Xlib: connection to ":0.0" refused by server' tsiMental Debian 11 02-16-2007 08:30 PM
Xlib: connection to ":0.0" refused by server Xlib: No protocol specified eyalkz Programming 1 03-02-2004 09:22 AM
Wine not working. Xlib: connection to ":0.0" refused by server Xerop Linux - General 1 02-18-2004 10:37 PM
What is "Xlib: connection to ":0.0" refused by server " rack201 Linux - Software 1 02-04-2004 08:49 AM


All times are GMT -5. The time now is 09:38 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration