Change owner of a currently running process Change owner of a currently running process linux linux

Change owner of a currently running process


You cannot do that, there's no such syscall. However, depending on how you want to affect the process, you could try some hack if the process is not critical to your system.

(gdb) attach process_id(gdb) call putenv ("UID=1234")(gdb) call putenv ("EUID=1234")(gdb) call putenv ("GID=1234")(gdb) detach

Note that this WILL NOT WORK:

(gdb) call setuid(1234)

This does not really answer to your question (change the owner of a running process), but considering that you may want to change the owner to affect something about the process, maybe this hack help.

Remember that it's very likely that this breaks your process.

(based on this: Is there a way to change another process's environment variables?)