I have some questions about Linux security:

  • Running a process as root is a big mistake (root has too much power + a program get too much permissions in the system). I always ran processes as a user (I just used chmod, chown to have access to special files and to be able to run them). Is that a better, than running a process/daemon/program as root?

  • What if I use sudo su and then start a process, is it equal to the security of running process as user? Or instead is it the same as running a process as root?

  • Should I install software as root? Or maybe as a regular user?
  • What about editing configuration files, should I do it as root or maybe, as I did before, with sudo su from my regular unprivileged user account?
  • "Big mistake" is overstating things. We prefer the phrase "Generally inadvisable", by which we mean that if you can run a process or service without needing root, you absolutely should, and when you can't you should try to take utmost care to minimize the exposure risk. Jul 17, 2020 at 5:03

2 Answers 2


The general idea is for a process to ask for (and have) the least amount of privilege it needs to do its job. Examples of this are web servers that bind to port 80 (which might need root) but then change to a non-privileged system user afterwards.

You may have noticed "might need root" not, "must have root". Traditionally, processes would have to start as root to bind to a port less than 1024 and would then change later. Now with capabilities if set up correctly you don't need to do this. CAP_NET_BIND_SERVICE will let you bind to a port less than 1024 not as root.

This is another iteration of "doing the same with less". Why run as root with ALL the access that gives when you only need one aspect which is binding ports. Capabilities give you this granularity.

The difference between starting the daemon as root or as a different user and sudo as root is minor and generally will give the same results.

For editing, admin work etc most people prefer being a "standard" user and sudo for those tasks. Making it impossible to login as root closes one possible insecure door.

Software generally is installed as root. Why? Because if your webserver can modify its binaries or config files (why yes apache, I think your publically accessible directory should be /etc) is a bad idea.


None of these are simple yes/no questions, they should have answers like "in some cases", "often", ...

That being said, I'll try to use yes/no answers anyway. I'm also assuming you have either a regular desktop or a tiny home server. Not something fancy.

This would give the following answers to you four questions

  1. Use it as the developer intended, if you start messing around with permissions and owners/groups chances are that things will break
  2. There are some issues with things that do and don't change when you use sudo su. Use sudo -i instead (or sudo -u someuser -i if you want to become someone else instead of root). sudo -i is like logging as root. Pretty much everything that has something to do with your user is 'forgotten'
    • If you are installing it from a package: use root.
    • If you are compiling it from source: use your regular user and only do make install (the last step) as root. (or don't do it all, this step is meant for reallocating the files to more 'sane' locations, but if think security is more important then you can skip it (this is rather paranoid))
  3. Use the user to whom the file belongs. This usually boils down to: Use root for everything in /etc, use your user for everything in your homedir.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .