after doing su -, opening graphical programs in terminal won't work
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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)?
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)
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)
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...
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.