1

I want to give an ordinary user the ability to fchown() files arbitrarily (as if they were the superuser) on FreeBSD. Generally speaking, is there a right way to change the privilege-checking of a given syscall?

I investigated Capsicum, but for all the articles on the topic, there is a real lack of practical examples out there.

3
  • why not use sudo?
    – Matt
    Mar 6, 2013 at 9:31
  • @mindthemonkey I don't want to fork an external program; I want to change the rules of the syscall itself.
    – ruief
    Mar 6, 2013 at 11:28
  • @ruief: Then I think the answer is clear: edit the source code.
    – bahamat
    Jun 14, 2013 at 4:12

1 Answer 1

0

One solution would be to create your own program that calls fchown(), chown it to root:wheel and set the setuid bit (chmod +s), files run with the setuid bit will be run as the owner the the executable.

Warning You didn't give any specific context, but be aware that allowing a user to run fchown() as root is a foot in the door to gain access to the entire system. For example, one might change the owner of /etc/{passwd,group,shadow}, change the contents, change the owner back, and presto! Instant root.

1
  • I don't want to fork an external program; I want to change the rules of the syscall itself. I am aware of the security implications of doing so.
    – ruief
    Mar 6, 2013 at 11:28

You must log in to answer this question.

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