How to have root access without logging as root? [duplicate]

Solution 1:

We are able to run Nautilus with root privileges with

sudo -i nautilus

but we need to be extra careful with what we do then.

Root is powerful and most measures to protect our system from accidents will not work any more. Nobody will stop Root from doing stupid things. There will be no warnings.

So here is my advice to people who need to run Nautilus as root:

  • Only do so for this one single task. Quit Nautilus after you are done to not accidentally do unwanted things as root which are meant to be done as a user.
  • Do not drag and drop. Only a slightly misplaced movement of the mouse may result in a broken system. In the worst case you will not be able to boot any more.
  • Do not bulk delete files or folders. You may have included an important system file by accident.
  • Do not copy files to the wrong place. Ubuntu has a very strict file system layout. It expects files to be in the place they are meant to and it does not expect other files to be there. All files we need to modify should be in our HOME directory.
  • Do not execute applications. All applications you run by clicking on a launcher, a binary, or a script will also be run as root. This rarely will be a good idea.
  • Never run Nautilus as root when you are a beginner. Only when understanding the file hierarchy and permissions you hopefully will be able to realize what is a good idea and what not. Before that you should for the sake of your system stability refrain from running Nautilus (or any other graphical application) with root privileges.

Nevertheless it will be fine to occasionally run Nautilus as root. I do so too, and command line typos may equally lead to severe system damages, especially when run recursively as root.

Solution 2:

Try using the

sudo

command before your command.

This gives you root permission. For more information see Root Sudo