How To Open A Directory with Root Privileges In Ubuntu 20.04 LTS?

How To Open A Directory with Root Privileges In Ubuntu 20.04 LTS?

 

This post was last updated on August 29th, 2020 at 08:31 pm

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.

Previous How To Install Apache Tomcat In Ubuntu 20.04 LTS?
Next How To List The All Enabled Repositories In Linux?
 

About author

You might also like

Linux Topics 0 Comments

How To Use Vi Text Editor An Easy Guide

This post was last updated on August 3rd, 2020 at 03:13 pmContents1 Introduction to vi2 Starting vi in your terminal3 Vi Operating modes4 Moving cursor around text5 Entering, modifying and

Linux Topics 0 Comments

Top Command Usage With Example In Linux/Unix

This post was last updated on August 1st, 2020 at 08:47 pmThe top is one of the most frequently used command in Unix like operating systems for the administrative tasks.

Linux Topics 0 Comments

How To Use apt-mark Command In Linux?

On different distributions of Linux that use apt as the default package manager, apt-mark can be used to show, set, unset various settings of a package. The apt-mark can be

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply