Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • I put setuid(uid) in my program that runs as root but I need it to run as a normal user & nothing happens i.e. it continues running as root Commented Sep 23, 2011 at 7:10
  • You probably need to catch the errors from it then(maybe you are getting an EINVAL for the uid). Its unlikely setuid is broken on your machine you can verify by seeing if apache is running as _www. Programmer docs: developer.apple.com/library/mac/#documentation/Darwin/Reference/… Commented Sep 23, 2011 at 7:15
  • you're right it gives a syntax error from the uid even though it is correct. is this the right format setuid(500)? Commented Sep 23, 2011 at 7:19
  • found the problem: I was trying to run the command through system() but I just run the command it work & solved my problem; thx for the help Commented Sep 23, 2011 at 7:29
  • No. This is not good advice: calling setuid() alone is absolutely not enough. Commented Feb 22, 2013 at 22:35