all Python 3Linuxosfunction
os.getresgid
os — user/group IDs
Return the (real, effective, saved) group ids. Availability: Unix.
Syntax
os.getresgid(...)
Like getresuid, but for groups: the real, effective and saved GID. After permanently dropping privileges all three should match, or the process could regain the group. Supplementary groups are not included — getgroups shows them.
Examples
import os
print(os.getresgid()) # → ? только Unix: тройка (реальный, эффективный, сохранённый) GID, например (1000, 1000, 1000)
rgid, egid, sgid = os.getresgid()
print(egid == os.getegid()) # → ? True: средний элемент тройки — тот же эффективный GID, что возвращает os.getegid()
print(rgid == egid) # → ? True у обычного процесса; у программы с setgid-битом эффективный GID берётся у группы-владельца файла и отличается от реального
print(sgid) # → ? сохранённый GID: значение, к которому процесс может вернуться через os.setresgid() после временного понижения прав
See also
Open in the full glossarydocs.python.orgReport an inaccuracy