dhcpkit.common.privileges module

Common code to handle privileges

dhcpkit.common.privileges.drop_privileges(user: pwd.struct_passwd, group: grp.struct_group, permanent: bool = True)[source]

Drop root privileges and change to something more safe.

  • user – The tuple with user info
  • group – The tuple with group info
  • permanent – Whether we want to drop just the euid (temporary), or all uids (permanent)

Restore root privileges