In Linux or Unix, you can perform almost any task by using a terminal. You need to have superuser privileges to perform tasks such as installation or removal of softwares, editing configuration files, etc.
Linux provides sudo command, to execute a command in privileged mode. Many users prefer to use GUI for some tasks, especially new users. Now suppose you want to move a file or folder that needs root permissions, how will you do that? By using the terminal you can do it easily.
If you are using GUI, some Debian based distributions such as Linux Mint; provide an option to open as root. In Ubuntu 20.04 and its some previous versions this option is disabled by default. In this article, we will discuss to enable this option in Ubuntu 20.04 and Xubuntu 20.04 LTS.
Nautilus
Nautilus is an official file manager for gnome desktops. It allows one to browse directories and open an application associated with them. It is also responsible for icon handling in gnome desktops. In Ubuntu, prior to version 17.10, you could use gksu
or gksudo
command to open the Nautilus file manager as root, then you can access a file or directory with the root permissions. To enable this option in later versions of Ubuntu including Ubuntu 20.04 or 18.04 you can follow the below steps.
Installing the nautilus admin tool
To enable open as administrator or root option, first, you need to install nautilus administrator tools in your system. To install this tool open terminal by pressing ctrl+alt+t
and then execute the following commands in it-
First, update the apt package index –
sudo apt update
And then use –
sudo apt install nautilus-admin
Press y if ask for confirmation. Once it gets installed reload the file manager with the following command.
nautilus -q
Using nautilus admin tool
Now nautilus administrator tool is installed in your system. When you right-click on a folder you will see an option to open it as administrator which means you can open a file or folder as an administrator or with root privileges. Look at the image below –
Once you click on open as administrator option it will prompt you for authentication as given in the image below. Enter your password and click on authenticate. This will open the directory with root permissions.
How to open a directory as root in Xubuntu 20.04 LTS
Xubuntu comes with the Xfce desktop environment which is a stable, light, and configurable desktop environment. Opening directory as root in Xubuntu is a little bit different from the Ubuntu because it uses DR Thunar as a default file manager instead of Nautilus.
Now to open a directory as root first, open the terminal by pressing ctrl+alt+t
And then execute the given command –
thunar admin://%f
Once this command gets executed you will be prompted for the authentication as given in the image below –
Enter your password and click on authenticate. This will open the filesystem as root now you can perform tasks such as creating, moving, or deleting a file or directory that requires root permission.
Alternatively, you can use the following command –
pkexec thunar
This will also prompt you to enter your password, once it gets successfully authenticated it will open the filesystem as root.
Conclusion
Be careful while using nautilus as an administrator you may end up with editing a system file which can make your system unusable. So use this tool only when it is needed.
Ok, that’s all for now. If you want to say something on this topic, you can share your thoughts with us in the comments below.