Question

I have a question about this post and it says that if you want to leave out the "sudo" in front of it, the following is described

how to run `hping` without `sudo`

sudo chown root:wheel /usr/local/Cellar/hping/3.20051105/sbin/hping3

sudo chmod u+s /usr/local/Cellar/hping/3.20051105/sbin/hping3

Now comes what I don't quite understand.

Is it correct that hping is allowed to run with root rights only because root is the owner?

It is still far from being authorized it is only said that root can make changes to this file or do I get it wrong?

Was it helpful?

Solution

User Richard Wick posted an answer which explains that the command has to call the setuid function in order to elevate the privileges of the command.

So changing command ownership to root and adding the s bit to the command's file mode is not enough. The command itself must also be written to ask the operating system for root privileges.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top