OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality.
All functions in os module raise OSError in the case of invalid or inaccessible file names and paths, or other arguments that have the correct type, but are not accepted by the operating system.
os.getresgid() method in Python is used to get the current process’s real, effective, and saved group ids and
os.setresgid() method is used to set the current process’s real, effective, and saved group ids.
Alternatively, we can also get real and effective group ids of the current process using
os.getegid() method respectively and can also set the real and effective group ids of the current process using
os.setegid() method respectively.
os.getresgid() methods are only available on UNIX platforms and functionality of
os.setresgid() method is typically available only to the superuser as only superuser can change group IDs of a process. Superuser means a root user or an administrative user who has all the permissions to run or execute any program in the operating system.
os.getresgid() method –
Parameter: No parameter is required
Return Type: This method returns a tuple whose attributes denotes real, effective, and saved group ids of the current process.
os.setresgid() method –
Syntax: os.setresgid(rgid, egid, sgid)
rgid: An integer value representing new group id for the current process.
egid: An integer value representing new effective group id for the current process.
sgid: An integer value representing new saved group id for the current process.
Return Type: This method does not return any value.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course