LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-17-2003, 08:29 PM   #1
TheOneAndOnlySM
Member
 
Registered: Jul 2003
Location: Dallas, TX
Distribution: Ubuntu 10.04 LTS
Posts: 987

Rep: Reputation: 30
after doing su -, opening graphical programs in terminal won't work


sometimes i need to run a few progs as root (such as ksysv or gedit as root ::yes i know i could use vi or pico: but whenever i do a normal su -, i enter the command gedit, xine, ksysv, or whatever and i get a gtk: couldn't open display warning

how do i solve this and what is causing this? i can run gedit fine if i open a terminal as user and type in the prog name
 
Old 10-17-2003, 09:12 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
xhost is the keyword... http://gd.tuwien.ac.at/linuxcommand....es/xhost1.html
 
Old 10-17-2003, 10:21 PM   #3
TheOneAndOnlySM
Member
 
Registered: Jul 2003
Location: Dallas, TX
Distribution: Ubuntu 10.04 LTS
Posts: 987

Original Poster
Rep: Reputation: 30
sweet, i'll give that a shot
 
Old 10-18-2003, 10:32 AM   #4
TheOneAndOnlySM
Member
 
Registered: Jul 2003
Location: Dallas, TX
Distribution: Ubuntu 10.04 LTS
Posts: 987

Original Poster
Rep: Reputation: 30
i tried xhost, but i still wasn't able to get root using the x server

i did xhost root and it told me that root was a bad host name
i tried xhost +root, same response
then i did xhost + to all all connections, but su -, and then doing a command like gedit still didn't let root connect to X

any other suggestions or has anyone else been able to get root to use graphical programs (when not logged in as root to gui)?
 
Old 10-18-2003, 11:23 AM   #5
net.head
LQ Newbie
 
Registered: Oct 2003
Posts: 1

Rep: Reputation: 0
This is the same on most *nix's, try this.

With the user you logged in as open up a terminal and type the following: -
xhost +localhost

This allows anyone on your machine to display to you're screen so a security risk if you're on a multi user machine but probably OK on a workstation.

Then to get you're GUI displayed back, from the same command window type: -

su -
export DISPLAY=localhost:0

Then just type the name of the command you want to display back, eg.

xclock
 
Old 10-19-2003, 01:42 PM   #6
TheOneAndOnlySM
Member
 
Registered: Jul 2003
Location: Dallas, TX
Distribution: Ubuntu 10.04 LTS
Posts: 987

Original Poster
Rep: Reputation: 30
nope, didn't work

did the xhost +localhost and export command

in fact, when i did the export command (i figured this would happen) for display, not even the user i was logged in with could open up programs (both gave me the error, gtk warning : could not open display)

fortunately, when i rebooted, things went back to normal, but still could not open anything gui related after having done su -

there has to be a way, other distros manage to do it (even though it is a security risk)
 
Old 10-19-2003, 03:08 PM   #7
diether
LQ Newbie
 
Registered: Oct 2003
Posts: 5

Rep: Reputation: 0
Try the complete name "family:name" when you issue the xhost command (check the man page for more details):

xhost + local:localhost

and then,

su -
DISPLAY=:0




Quote:
Originally posted by TheOneAndOnlySM
nope, didn't work

did the xhost +localhost and export command

in fact, when i did the export command (i figured this would happen) for display, not even the user i was logged in with could open up programs (both gave me the error, gtk warning : could not open display)

fortunately, when i rebooted, things went back to normal, but still could not open anything gui related after having done su -

there has to be a way, other distros manage to do it (even though it is a security risk)
 
Old 10-19-2003, 04:13 PM   #8
TheOneAndOnlySM
Member
 
Registered: Jul 2003
Location: Dallas, TX
Distribution: Ubuntu 10.04 LTS
Posts: 987

Original Poster
Rep: Reputation: 30
is it DISPLAY=:0 or DISPLAY=localhost:0?
 
Old 10-19-2003, 04:26 PM   #9
diether
LQ Newbie
 
Registered: Oct 2003
Posts: 5

Rep: Reputation: 0
DISPLAY=:0
 
Old 10-26-2003, 04:21 PM   #10
JesterXXV
LQ Newbie
 
Registered: Jun 2003
Distribution: Slackware 9.1
Posts: 7

Rep: Reputation: 0
I'm just a n00b myself, but I know if you just use 'su' without the hyphen, you'll be able to run X stuff just fine. IIRC the manpage basically said that the hyphen makes the su login think it's running in a console instead of a terminal. Although there could be some benefit to it that I'm not aware of...
 
Old 10-27-2003, 05:43 PM   #11
TheOneAndOnlySM
Member
 
Registered: Jul 2003
Location: Dallas, TX
Distribution: Ubuntu 10.04 LTS
Posts: 987

Original Poster
Rep: Reputation: 30
sweeeet! I cannot believe I missed something so blatantly obvious!

yes, of course, by running su without the hyphen, all I am doing is telling linux to allow the user i am currently logged on as to have superuser privileges without being logged in as su

however, su - actually logs me in as root and inside the terminal it now believes that i am running in a full superuser environment; thus it tries to connect to the x server as though it was allocated for root's use; doing su keeps the user in direct contact with the x server but allows me to access all the things only root should be able to touch

the advantage of su -, however, is that certain commands are in "sbin" folders and they are spread out around the the system; so instead of having to run say /sbin/fdisk, i can do su - and then just type fdisk
this is only useful because fdisk could have been in /sbin, /usr/sbin, /usr/local/sbin, /etc/sbin, /home/bla/hello/where/in/the/world/is/this/going/sbin and i would have had to try all those before i found where fdisk was

thx man

do a plain su to access graphical things as root in terminal
 
  


Reply



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
error with opening a new terminal wind. Dannydy Linux - Software 2 10-14-2004 05:09 PM
How to open programs in terminal without being stuck to the terminal?? brynjarh Linux - Newbie 6 07-07-2004 12:52 PM
Opening a new terminal from Fluxbox menu (or another terminal) hallamigo Linux - Software 1 05-02-2004 03:32 AM
Opening programs .... wont work HELP JMK Linux - Newbie 2 03-14-2004 03:39 PM
Error opening terminal: linux joadoor Linux - Software 1 06-11-2003 03:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:54 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