Running script or command as non-root user in OpenWrt

How execute command as another user without 'su' and '/etc/init.d/..' service scripts?
'another user' is a non-privileged user from the '/etc/passwd'.

Depending on what you're trying to achieve, it may or may not actually make sense to setup additional users. But here's some information.

If you want to know if there's actually value in creating a non-privileged user, feel free to share your application/goals.

1 Like

I would like to run some demon from command line with non-root user.
Yes, i know about ’how create a new user. The issue is only possibility to run demon with help non-root user.

For example, in case “su” available in linux, it’s looks like:
su –c [command] [other_user]

If you're running a process that requires super user escalation (i.e. su or sudo), why bother running with a non-root user on OpenWrt?

1 Like
``` opkg update; opkg install sudo sudo -u other_user command ```

The su (short for substitute or switch user) utility allows you to run commands with another user’s privileges, by default the root user.

another != root

Thanks, i know about this possibility, but i needs to exec demon without su, and i know that init.d scripts can do it (without su), but right now i could not understand how it is implemented

[]( [](

i know about ‘how use init.d scripts’
I'm sorry, i am repeating, but:


  • Login as user
  • Execute command

Links on creating users have already been provided.



Bad joke)

one more again.
I looking of method to execute some code/demon/script under the root, but with another user's privileges (without 'su'). As it is possible with help init.d scripts and would like do it, without init.d.

Please read answers, before post a new message

Yes, did you review?



You as well.

Otherwise, provide an example of what you mean (i.e. only user root using an account that doesn't exist). Otherwise, you must create the account.


Nope - please [at least] respect those who took time to answer you.

Ok, special fyi,

after that, you can do it:

and the last action is provide possibility to run any applets/scripts under the new user (non-root).

after than, please read again topic question :slight_smile:

1 Like

Yes, those are the steps.

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

can i hope to get you respect?

You finally ask:

  • We don't control your binary program (which still exists on an OS created with only root as the user).
  • If you're asking for an example of a program that does what you ask:

So, yes it's possible.