******test.c*******
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<unistd.h>
int main(int argc, char** argv)
{
uid_t uid, euid;
uid = getuid();
euid = geteuid();
if (setreuid(euid, uid)) perror("setreuid");
system("command");
return 0;
}
/***********************/
编译:gcc -o test -Wall test.c
root下:chmod u+s test
时间: 2024-10-18 04:19:34