I understand how to make an executable also execute as root with the chmod u+s command to set the suid. What I am wondering is how I would get the executable always executed as a non root user that is different from the user that is executing the file.

So for clarity let's say I have Alice and Bob users, both not in the sudo group. Alice creates an executable that reads something from her homefolder and wants to make sure that Bob can execute the file as well but does not want to have the executable run with root privileges due to security concerns. How can Alice make sure that the file is always ran under her user without Bob needing her credentials?

1 Answer 1


The suid flag will ensure the file is always executed as the current owner of the file, not root.

So if you want a file to always run as alice, then let it be owned by alice using: chown alice filename, then set it as suid.

  • 1
    Ah I see, I misunderstood the suid flag! thanks for your answer!
    – Wealot
    Commented May 30, 2017 at 11:24

You must log in to answer this question.

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