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.
Slackware newbie(and linux as well)
Dell Dimension 520 P4 3GHZ RAM 3GB HD 2*250GB Nvidia GeForce 7300LE
Installed:hd0 WinXP prof
hd1 Ubuntu/Kubuntu,LinuxMint,FedoraFC8,Suse10.3,Sabayon,Mandriva8,
Debian4,Slax6.03,Slackware12.2
Everything running fine with Kubuntu's grub bootloader in the MBR booting every system.
Slackware is running QK now(after a few glitches)but I still have a problem in the konsole.
When I go in as user and want to switch to root to change something using Kwrite or Kate I always getas example)
zeger@HOME:~$ su
Password:
root@HOME:/home/zeger# kwrite /etc/fstab
No protocol specified
kwrite: cannot connect to X server :0.0
So I have to switch user and go in as root and then it's OK.I think I must have done something wrong when adding the user but I have no clue.
Otherwise everything is running fine so far(as far as I can tell)
No, you did not make any mistakes. In KDE, I edit the K menu (right click on the K menu to get that option), find KWrite under the System header, highlight & copy it, then immediately paste it back. Now you have two entries for KWrite. Select one of them & modify the "command" to add "kdesu " (that's kdesu[space]), without the double quotes, before the command. Also modify the "Name" so that it will be different from the original one, I usually use "KWrite - Root Privileges".
Regards,
Bill
Last edited by TSquaredF; 01-22-2009 at 08:43 AM.
Reason: typos
To add some more detail, the reason it doesn't work is because the root user doesn't have permission to connect to the current user's x-session, and also probably doesn't even have the DISPLAY shell variable set.
Using something like kdesu, or "su -" to log in transfers the the current user's environment settings to root so you can run gui programs. You can also set it manually with the following commands.
To give the local root access permission, run "xhost +localhost" as the user owning the x-session (notice that playing around with xhost can be a security risk).
To set the display variable, run "export DISPLAY=:0" as root (assuming the current display is 0, of course). Now that shell knows how to find the display to use.
To make the settings permanent you need to add them to your bash startup scripts.
And the reason is that you "own" the connection from the server to the display, not "root". The X-server is complicated enough, and adding multiple owners for the same display in the mix, while possible, is not often a problem.
As t^2F said, you can create a menu entry so you own the display while letting root write to it.
Even simpler is to add yourself to /etc/sudoers. Then, instead of su -c 'kwrite <file>' (which won't work), you can do a sudo kwrite file (which will).
OK First I tried to duplicate kwrite and that worked once,but after that and in the same konsole session it didn't work anymore. After I closed the konsole and restarted it even kdesu didn't work (same message)So I rebooted but no result.
Then I added myself to /etc/sudoers and did sudo kwrite /etc/fstab
It works and I can edit fstab but this is what I get:
zeger@HOME:~$ sudo kwrite /etc/fstab
Password:
Error: "/var/tmp/kdecache-zeger" is owned by uid 1000 instead of uid 0.
Error: "/tmp/kde-zeger" is owned by uid 1000 instead of uid 0.
zeger@HOME:~$
I understand that it is owned by me and not by root(uid O)correct?
Should I leave it like that or change something?
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810
Rep:
May I take it that you are booting up into run level 4 as booting into run level 3 and running "startx" to start KDE makes what you are trying to do work fine.
To be honest X isn't my field so I don't exactly know what the differences in starting it up my mean. I've been following this thread thinking "That's strange - I do this all the time with no problems." I start in run level 3 however.
Booting up in runlevel 4 indeed which I find easier. I am not sure it has something to do with my problem though; I think it would have been the same with runlevel 3. Anyway it is fixed now.
Thank you all for the help!
Those "owned by 1000 not 0" are just warnings that you see because stderr is directed to your terminal. They're safely ignored. (Obviously, you're user number 1000 whilst root is 0.)
[edit]
Oh, a couple additional thoughts:
1) If you want to spawn your sudo session, you need to "activate" the sudo before you spawn the edit session.
2) If you don't want to see the messages, direct stderr to dev/null
Here's an illustration:
Code:
$ sudo echo
[sudo] password for Peter:
$ sudo kate /etc/fstab 2>/dev/null &
7139
$ disown
$
Last edited by PTrenholme; 01-22-2009 at 06:49 PM.
OK First I tried to duplicate kwrite and that worked once,but after that and in the same konsole session it didn't work anymore.
This doesn't sound like the instructions I posted. If you follow my post, you will have an entry in your K Menu right next to the original KWrite entry. Clicking on that entry will bring up a dialog box requesting your root password. After the password is entered, KWrite will start in root mode. Konsole is not involved at all.
Regards,
Bill
This doesn't sound like the instructions I posted. If you follow my post, you will have an entry in your K Menu right next to the original KWrite entry. Clicking on that entry will bring up a dialog box requesting your root password. After the password is entered, KWrite will start in root mode. Konsole is not involved at all.
My mistake. I misunderstood. Redid it the way you said and it works like a charm.Thanks
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.