I'm working on a Linux powered consumer electronics. Everything user interacts with is running as root (legacy design). Should I make the application run as its own user with restrictions?

  • The Good Idea is to run nothing as root. But I suspect that you already know that. Maybe you should expand your question?
    – schroeder
    Commented Sep 6, 2019 at 13:35

4 Answers 4


Yes. You should run as little code as possible as root. Create a user for the application, or more than one user if the application can be broken up into loosely coupled pieces. In particular, if the user enters private identifying information such as their name or credentials to an online account, or they enter private data such as their favorite recipes/TV shows/…, the private data should preferably isolated and only readable by an account that does as little as possible.

If there's any firmware update mechanism, it should run as a separate user from the main application so that if the main application user is compromised, there's still a chance to recover.

This is good not only to protect against attacks, but also to defend against bugs of non-malicious origin. And this is good even if you aren't too worried about attacks (but who isn't these days, with everything getting online), because it also makes the device more robust against accidental bricking if there's less code that's able to modify the firmware.


Should I make the application run as its own user with restrictions?



Yes. This is the basic tenet of Defense in Depth. If your application has a security flaw some place which could allow an attacker to read/write to the file system or execute code, the attack can be stopped if the user account does not have permissions to perform the actions which the attacker is attempting.


Dont run as root as much as possible. Still if you want to run as root check what the POSIX capabilities you really neeeds and restrict the capabilities of you root application to a basic minimum required. Otherwords, apply least privilege principle. Even if some of the vulnerabilities in your code are exploited, limiting capabilities will restrict from critical threats(for example network access).

You must log in to answer this question.

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