Ubuntu – How to elevate nautilus privileges to move or copy a folder as root

nautilus

Say I have a folder open in Nautilus that's in my /home/user/temp directory. I'd like to move a folder from there to my /opt directory (it's a program). Is there a way I can elevate the copy command up to a sudo so that I can copy the folder without having to start a new instance of Nautilus from the command line?

Best Answer

As far as I can say, based on what I know and have experienced:

sudo is used for command line applications/commands and gksudo is useful when you try to run a program using the Run Application dialog window by pressing Alt+F2.

I have read that gksudo is just the graphic version of sudo.

Anyway, you can both drop sudo nautilus and/or gksu nautilus in a terminal for the purpose to do what you wish, having the same effect both commands. But if you want to omit the terminal and you wish to run it directly with the "Run Application" dialog window, just press Alt+F2 and write gksu nautilus, after which you will be prompted to enter your password, then the nautilus file browser will open with root privileges.

Additionally, you can achieve to open files/folders as root with a single click by using the "Open as Administrator" option via right click. Which in any case will open a new nautilus instance for the given folder and will open files as root, this may also open/run applications as root but I haven't tested it yet.

enter image description here

You can get the "Open as Administration" option in your contextual menu by installing nautilus-gksu via command line: sudo apt-get install nautilus-gksu or by using synaptic as shown in the next image:

enter image description here

Good luck!