On this page
posix.fchown
Prev: posix.fchmod | Up: posix | Next: posix.fork
Rel: posix.abort, posix.access, posix.chdir, posix.chflags
Ref: docs.python.org — posix.fchown
Tags: #public #python3 #stdlib #posix
Import
import posix
from posix import fchown
Signature & Overview
posix.fchown(fd, uid, gid)
Change the owner and group id of the file specified by file descriptor.
Usage
import os, tempfile
with tempfile.TemporaryFile() as f:
os.fchown(f.fileno(), os.getuid(), os.getgid())
Gotchas
- Unix-only race-free ownership change on an open fd.
REPL Inspect
from posix import fchown
help(fchown)
Linked from
Related notes
- tuts/python3/stdlib_module/posix/fchmod Linked here; links to this page; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/fork Linked here; links to this page; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/posix/abort Linked here; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/access Linked here; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/chdir Linked here; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/chflags Linked here; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/chmod shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/chown shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/chroot shared tags: #posix, #stdlib