New answers tagged

0

In order to change just the uid you can use: C/C++: #define _GNU_SOURCE #include <unistd.h> void main() { setresuid(1000,1000,1000); // where 1000 is the new uid system("/bin/bash"); } Python: python3 -c 'import os; os.setreuid(1000,1000); os.system("/bin/bash")' That gives a shell with id: uid=1000(bl4ckc4t) gid=1001(test1) ...


1

The Linux system calls to do this are setreuid or setresuid, both available in section 2 of the manual. The difference is that setresuid lets you choose the saved user ID, whereas setreuid sets it automatically. If you're using C/C++, this is easy; just #define _GNU_SOURCE and #include <unistd.h> (or the equivalent to call the relevant APIs in your ...


3

From man symlink(2): The permissions of a symbolic link are irrelevant; the ownership is ignored when following the link So no, without write permissions on the file, you may not edit it. There is also not a "symlink file"; the symlink is just a pointer to another file.


Top 50 recent answers are included