Quick Answer
Use gksudo nautilus
or sudo -H nautilus
or sudo -i nautilus
instead.
Explanation
You shouldn't use plain sudo
to run graphical applications, because it makes root and your non-root user account try to use the same configuration files, which often causes root to own files that the non-root user needs to (but cannot) access.
Recent versions of Nautilus will actually recognize this problem and refuse to run, in order to prevent their per-user configuration from being broken on your non-root user account.
The solution to this problem is, when running graphical programs as root
(especially Nautilus), use a method that avoids this problem. The methods that avoid this problem are the methods that make the program you're running look for and create configuration files in root's home directory (/root
), rather than your own home directory (/home/ussername
).
The Solutions, and Why They Work
The HOME
environment variable is usually consulted to determine the home directory to be used. You want this to be set to /root
. You don't do this directly; instead, run graphical applications in a way that does this for you automatically.
Traditionally, all Ubuntu systems had gksudo
or (for Kubuntu) kdesudo
installed, and you would use them instead of sudo
when running graphical applications. That might work; I recommend you try replacing sudo
with gksudo
before you try anything else. Unfortunately, gksudo
is not always installed on the newest versions of Ubuntu. You can, of course, install it (in the Software Center or with sudo apt-get update && sudo apt-get install gksu
).
Also, please note that traditionally, on Ubuntu, gksu
and gksudo
did the same thing. But a recent bug sometimes makes gksu
behave in a way that doesn't work right for an Ubuntu system. This is why I recommend gksudo
, even though I have usually recommended gksu
(which does "the right thing" on many different Unix-like systems, when properly configured).
But there are alternatives to gksudo
. You can tell sudo
to run a program as root and use root's home directory instead of yours:
sudo -H nautilus
If you don't have gksudo
, I recommend sudo -H
. However, you can also use:
sudo -i nautilus
sudo -i
simulates a full root login (even if actual root logins are disabled), which sets many environment variables, including HOME
, to their root-user values.
(After the command is run, and in other programs or other commands that are not started from the program you're running as root, the environment remains unchanged. You never have to "change it back.")
gksudo nautilus
? This is preferred for GUI applications. – Sparhawk Aug 13 '13 at 06:01gksudo
? This shouldn't reference your personal home directory. (e.g. http://askubuntu.com/questions/11760/what-is-the-difference-between-gksudo-nautilus-and-sudo-nautilus ) – Sparhawk Aug 13 '13 at 06:02(nautilus:2950): IBUS-WARNING **: The owner of /home/radhika/.config/ibus/bus is not root! Nautilus-Share-Message: Called "net usershare info" but it failed: 'net usershare' returned error 255: net usershare: cannot open usershare directory /var/lib/samba/usershares. Error No such file or directory Please ask your system administrator to enable user sharing.
– Sweety Mouni Aug 13 '13 at 06:04