The code is as follows:
Copy the Code code as follows:
#include
#include
#include
#include
#include
int main (int argc,char * argv[])
{
uid_t Uid,euid;
Char cmd[1024]= "Chmod-r 777";
UID =getuid ();
Euid = Geteuid ();
printf ("param%s\n", strcat (Cmd,argv[1]));
Exit (0);
printf ("Uid:%un. Eudi=%un\n ", Getuid (), Geteuid ());
if (Setreuid (EUID,UID))
Perror ("Setreuid");
printf ("Uid:%un. Eudi=%un\n ", Getuid (), Geteuid ());
System (strcat (cmd,argv[1));
return 0;
}
Now, under Linux, GCC compiles, as well as the problem of the right to restoration:
Perform
Gcc-wall-o Phpchmod PHPCHMOD.C
Perform
chmod u+s./phpchmod
Use of PHP code:
Copy the Code code as follows:
$chmod _line = dirname (__file__). " /phpchmod./dest_dir/";
System ($chmod _line);
The above describes the Linux System command PHP to execute system commands, including the Linux system command content, I hope the PHP tutorial interested in a friend to help.