Project

General

Profile

Actions

Linux operation » History » Revision 1

Revision 1/2 | Next »
jun chen, 04/22/2025 04:40 PM


Linux operation

owner wrapper

如果需要征用其他人权限,移交文件所属权

Wrapper script

g++ getid.cpp -O3 -o br_pc_wrapper
chmod +s br_pc_wrapper

Wrapper code

#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <cstring>

real_uid = getuid();
effective_uid = getuid();
seteuid(4219);
setuid(4219);
setreuid(4249, 4249);
system(argv[1]);

Updated by jun chen about 2 months ago · 2 revisions