Kate
Nils Kassube
kassube at gmx.net
Thu Apr 30 06:57:12 UTC 2009
Steven Vollom wrote:
> > > steven at Yeshua:~$ sudo kate
> > > [sudo] password for steven:
> > > Error: "/var/tmp/kdecache-steven" is owned by uid 1000 instead of
> > > uid 0. Error: "/tmp/kde-steven" is owned by uid 1000 instead of
> > > uid 0. Error: "/tmp/ksocket-steven" is owned by uid 1000 instead
> > > of uid 0.
>
> Thanks, I was advised, tried and it worked, kdesudo kate, but I still
> don't understand the error. I have seen this before and no one ever
> has explained the comment uid 1000 instead of uid 0. I believe I am
> user ID 1000, but I don't understand how User ID 0 comes into the
> picture. Will you explain this a bit? Thanks! When I happens
> again, I would like to understand the comment.
Yes, you are user steven with UID 1000 and UID 0 is user root. When kate
starts, it looks for links in the directory $HOME/.kde which point to
the directories mentioned in your error messages. Those directories are
supposed to be owned by the user starting kate. If you use sudo, the
UID is 0 (for root) but the directories are owned by UID 1000 (steven).
If you use sudo, the $HOME environment variable points to /home/steven.
Therefore kate finds the links in /home/steven/.kde pointing to the
directories of the error messages. OTOH, if you use kdesudo instead,
the environment variable $HOME is set to /root which is the home
directory of the user root. There kate finds the appropriate
directories which are actually owned by UID 0 (root) and therefore it
doesn't complain but starts normally.
You can see the difference between the environment variables with these
commands in a terminal:
sudo bash -c set >set1.txt
kdesudo "bash -c set" >set2.txt
diff -u set1.txt set2.txt >diff.txt
kate diff.txt
The first two commands write the environment variables to the files
set1.txt and set2.txt and the third command compares the environments
writing the output to diff.txt. Then kate opens that file and it shows
the difference in red / blue. The important part is the HOME variable
which is different. The other differences aren't important here.
Now, if you try to start kate with sudo instead of kdesudo it just
refuses to start because of the possible problems it may cause if you
want to start it without sudo later. Other programs may not complain
and simply use the (wrong) $HOME variable to find the path to
configuration files and change the ownership of the config files to
make them owned by root. That will of course bite you later when you
want to use the application as normal user. Therefore always use
kdesudo instead of sudo to start graphical applications as user root.
Nils
More information about the kubuntu-users
mailing list