YouTip LogoYouTip

Os Chown

# Python2.x Python os.chown() Method [![Image 3: Python File Methods](#) Python OS File/Directory Methods](#) * * * ### Overview The os.chown() method is used to change the file owner. If you do not want to modify it, you can set it to -1. You need superuser privileges to perform the permission modification operation. Only supported on Unix. ### Syntax The syntax format of the **chown()** method is as follows: os.chown(path, uid, gid); ### Parameters * **path** -- File path to set permissions for * **uid** -- Owner user ID * **gid** -- Owner group ID ### Return Value This method does not return a value. ### Example The following example demonstrates the use of the chown() method: ## Example #!/usr/bin/python # -*- coding: UTF-8 -*- import
← Linux Comm CpioLinux Comm Compress β†’