All functions in the os module raise OSError for invalid or unreachable file names and paths or other arguments that are of the correct type but are not accepted by the operating system.
os.setreuid () in Python is used to set the real and effective user IDs of the current process.
Every user on Unix is such an operating system is identified by a different integer, this unique number is called the UserID. Real UserID represents the account of the owner of the process. It determines which files this process has access to. The effective user ID is usually the same as the real user ID, but sometimes it is changed to allow an unprivileged user to access files that can only be accessed by the root user.
os.setreuid() is only available on UNIX platforms, and the functionality of this method is usually only available to the superuser.
Superuser — it is a root user or administrator who has full rights to launch or run any program in the operating system.
Syntax: os.setreuid (ruid, euid)
ruid : An integer value representing new user id for the current process.
euid : An integer value representing new effective user id for the current process.
Return Type: b> This method does not return any value.
Code: using the os.setreuid () method
Real user id of the current process: 0 Effective user id of the current process: 0 Real and effective user ids changed Real user id of the current process: 100 Effective user id of the current process: 200