I'm running on a linux box, a process as a regular user, this is the only way I can start this process. After it starts I can put a break point inside the main function, after it hits the breakpoint I can do what ever I want to the process (I'm root on the system). I'd like to change the process owner from the regular user to root, is it possible?
Asked
Active
Viewed 69 times
-1
-
Maybe [this](http://stackoverflow.com/questions/428920/changing-the-owner-of-an-existing-process-in-linux) will help you. – VP. Nov 21 '13 at 10:14
-
Any other suggestions? I'm looking for a way to do it without changing the code. What I want is after the process hits the breakpoint, do some linux magic and turn my process owner to root – e271p314 Nov 21 '13 at 10:21
-
So you just need a linux command to do that? – VP. Nov 21 '13 at 10:35
-
Yes, something like `chown` that can take `pid` as an argument not just a file – e271p314 Nov 21 '13 at 12:41
1 Answers
1
If you're running gdb as root
you should be able to achieve this by running the command:
call setuid(0)
Hope this helps

jcm
- 2,568
- 14
- 18
-
This is a good option but unfortunately I'm forced to run `gdb` as a regular user – e271p314 Nov 21 '13 at 12:38