¿Establecer la bandera SUID en un archivo?

I have a python file that I would like to set the SUID flag on. So that if any normal user executes it it executes as root. I know it's a security issue but I still need to set the SUID flag.

preguntado el 09 de enero de 11 a las 06:01

Do you have a question of some sort that we could answer? -

The question seems to be: "How do I set the SUID bit on a script?" -

1 Respuestas

You need a native image for the suid bit to work on modern Unixes. If you really have that requirement, I would write a C/C++ program with the embedded Python code that cleans the environment and then executes the script.

A good way to do that is to use boost::python to embed Python into a C++ program so that you can build a safe, statically linked image.

Depending on what you are really trying to do, another option would be to turn your script into a daemon process, started from a known context (eg. using daemontools), and then have users communicate with it when they need something done, for example using a named pipe with appropriate access control.

Whether the second option is appropriate depends on what you really need.

Respondido el 09 de enero de 11 a las 09:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.