How to open root folder or any file as root user in Linux !!

Filed in Linux

This is very common problem for every new user in Linux to open file system as root user.

Many times its needed to open and run file as root user. In this section I am going to tutorialized two methods to open any folder or right click open as root user in Linux.

Method 1:

This is the easiest and can be used without any editing thing.

  1. Hit ctrl+alt+t to open terminal
  2. Type “gksudo nautilus” in the terminal

This should bring the root folder up in a new window and if you only see a desktop in the folder hit ctrl+h too to see hidden files.

Method 2:

  1. Open a terminal and type sudo su
  2. Then type the following:
    gedit .gnome2/nautilus-scripts/Open\ as\ root
  3. Now add the following to the open document and save the file:
    for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; dogksudo “gnome-open $uri” &done
  4. Back at the terminal, type:
    sudo chmod +x .gnome2/nautilus-scripts/Open\ as\ root

All set, now when you want to open a file as root, simply right click the file and select Scripts-> Open as root

Leave a Reply

Your email address will not be published. Required fields are marked *