This is used in a project. another service is used to do some things. the generated file permissions cannot be read through php, and many methods have not been implemented, if I find it online, I can use c to write a proxy to implement it. I can implement it myself. The code is as follows:
The code is 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 let's talk about gcc Compilation and permission reproduction in linux:
Run
Gcc-Wall-o phpchmod. c
Run
Chmod u + s./phpchmod
Php code usage:
The code is as follows:
$ Chmod_line = dirname (_ FILE _). "/phpchmod./dest_dir /";
System ($ chmod_line );