LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   can't start program from shell (http://www.linuxquestions.org/questions/linux-general-1/cant-start-program-from-shell-308850/)

roxxe1 04-02-2005 01:00 AM

can't start program from shell
 
why cant i do this no more?

Code:

root@1[~]# synaptic

(synaptic:11973): Gtk-WARNING **: cannot open display:

actually all programs i run in shell give that :(
is there a way to fix it?

hallamigo 04-02-2005 01:18 AM

Looks like you are trying to run the program as root. Did you log into Xwindows as root? If not (you got to root via 'su') then by default root (su) cannot run Xwindows inferfaces (Gtk or Qt). I'm not sure how to allow root (su) to do so while logged in with a user account but if you need to run it as root then I'd suggest restarting Xwindows as root (assuming the answer to my initial question is no).

roxxe1 04-02-2005 01:29 AM

weird
when i'm logged in as a normal user, and i type "synaptic", the shell says i should be logged in as superuser :s

and if i log as root, it wont open :s

hallamigo 04-02-2005 01:32 AM

So when you log into Kde/Gnome (or whatever your GUI is) as root (not using 'su') it still won't let you open it? If so, that's the error it throws? What is your distro and what windows/desktop manager are you using?

mike33 04-02-2005 01:34 AM

as an ordinary user type the command:
xhost +
Then root will be able to open windows in X.

roxxe1 04-02-2005 02:24 AM

Quote:

Originally posted by hallamigo
So when you log into Kde/Gnome (or whatever your GUI is) as root (not using 'su') it still won't let you open it? If so, that's the error it throws? What is your distro and what windows/desktop manager are you using?
it wont, you can see the error above, i'm using simple mepis (debian), using kde

Quote:

xhost +
thanx it works, but do i have to type that everytime?, if not how can i make my system do it everytime i login?

frob23 04-02-2005 02:33 AM

Quote:

Originally posted by mike33
as an ordinary user type the command:
xhost +
Then root will be able to open windows in X.

xhost + does work but is terribly insecure. It allows any computer to control your X display remotely. It is wiser to use
Code:

xhost +127.0.0.1
which will just allow access from the local machine. It assumes that anyone running a command while logged into the machine should have permission to access the display. This is a fairly reasonable assumption for a home machine.

You don't need to do this all the time (just if you want to run a program as a different user and if you have restarted the window system since the last time you ran it). If you want to make it permanent (and you probably do) just edit your
startup files (~/.xsession & ~/.xinitrc) and add that line before the last line in the file.

roxxe1 04-02-2005 07:01 AM

uhm, noobie question, where is my xinitrc located?
tried searching for it with konqueror, but no result
my xession was located in my /etc/x11

AxeZ 04-02-2005 08:12 AM

Quote:

Originally posted by roxxe1
uhm, noobie question, where is my xinitrc located?
tried searching for it with konqueror, but no result
my xession was located in my /etc/x11

~/.xinitrc

~ means it is in the root of your home directory, something like /home/roxxe1/.xinitrc

pAn1k 04-02-2005 10:52 PM

A good solution might be to type in kdesu <command> it should run properly.

roxxe1 04-24-2005 03:41 PM

is kdesu the same as gnomesu?

pAn1k 04-24-2005 07:58 PM

uhhmm... probably. I don't use gnome, but I'm sure it is.


All times are GMT -5. The time now is 05:35 AM.