0

I wanna call CMake from a setuid executable on Linux. The code for the callcmake.cpp is:

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

int main(int argc, char *argv[]) {
    setuid(geteuid());
    system("cmake ..");
}

and then I typed the following under account A

g++ callcmake.cpp -o callcmake
chmod 4755 callcmake

I tried to run this callcmake with another account B, cmake has the following output:

CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:172 (CONFIGURE_FILE): configure_file Problem configuring file Call Stack (most recent call first): CMakeLists.txt:4 (project)

-- The C compiler identification is unknown CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:177 (CONFIGURE_FILE): configure_file Problem configuring file Call Stack (most recent call first): CMakeLists.txt:4 (project)

How can I run cmake with a setuid program?

Raymond
  • 41
  • 4

0 Answers0