listener module

listener.setuid(uid)[source]

Set the current process’s effective user id. Use unsetuid() to return to the listeners UID.

When used with any other user than root. Be aware that listener.unsetuid() will not be possible afterwards, as that requires root privileges.

Parameters:uid (int or str) – UID the process should have
Returns:None
listener.unsetuid()[source]

Return the current process’s effective user id to the listeners UID. Only possible if the current effective user id is root.

Returns:None
listener.run(file, argv, uid=-1, wait=1)[source]

Execute a the program file with arguments argv and effective user id uid.

Parameters:
  • file (str) – path to executable
  • argv (list(str)) – arguments to pass to executable
  • uid (int) – effective user id the process should be started with
  • wait (bool) – if true will block until the process has finished and return either its exit code or the signal that lead to its stop (a negative number), see os.P_WAIT. If false will return as soon as the new process has been created, with the process id as the return value (see os.P_NOWAIT).
Returns:

exit code or signal number or process id

Return type:

int