Fix KDE permissions after sudo startx

file-permissionskde

After experiencing some issues with KDE (4.7.1, on Kubuntu 11.10), I tried to restart it. The recommended sudo /etc/init.d/kdm restart stopped it, but it failed to start, instead getting stuck on a console screen (with the standard services closing, etc, shutdown text). I could type in it, but not do anything else, ctrl + c doing nothing.

I switched to tty1 (ctrl + alt + F1) and ran the command sudo startx. This started another instance of KDE on tty8 – the normal one is on tty7, which was still stuck on that console screen. It could be used as normal, nothing odd at all. The problems started appearing after a restart.

Error messages (KDialog):

Configuration file "/home/kubuntusandbox/.kde/share/config/kmixctrlrc" not writable.
Please contact your system administrator.
Configuration file "/home/kubuntusandbox/.kde/share/config/kmixrc" not writable.
Please contact your system administrator.
Configuration file "/home/kubuntusandbox/.kde/share/config/krunnerrc" not writable.
Please contact your system administrator.

Aside from this, several kdesudo boxes popped up for various programs on the first start. They did not appear after one restart. It's possible a proper shutdown as restored some permissions. Similar (KDialog, kdesudo) boxes come up when opening some programs, e.g. KSnapshot.

Now, this is evidently because running KDE as root has changed some permissions. What I need to know is what should I change back and how do I do that, while minimising side effects? In other words, I don't want to overwrite all permissions in the system, just the ones that were affected.

This is likely on Google somewhere. I've seen it before, a year or two ago. However, it's eluding my searches at the moment.

Just a note, this is actually a fresh install of Kubuntu on a VM. I'm going to reinstall it anyway, but this is for future reference.

Best Answer

A source recommended:

Try: rm -rf ~/.kde

This will erase all your personal settings, and make kde behave as if it is your first login...

If you have bookmarks/address books you want to keep then back them up first...

Taking a closer look at ~/.kde/share/config/ revealed quite a few files owned by root. The rest are owned by kubuntusandbox (my user).

What did work is sudo chown -R kubuntusandbox ~/.kde, where kubuntusandbox was my username.

I'm not sure if this reset any settings, but it should not have. It's less drastic than deleting the whole thing and letting KDE recreate it, anyway.

Related Question