Changing File Ownership and Permissions

Two programs in the command-line arsenal help change file ownership and permissions. chown, or Change Ownership, lets you change a file (or group of files) to another owner. chmod lets you change the access permissions to individual files.

Using the chown Command

To change the owner of a file, you use the chown command. Log in as the root user and enter the following command:

[root@insocoxygen /root]# chown ownername filename

where ownername is the login name of the user you want to change the file's owner setting to, and filename is the name of the file for which you want the owner changed.

For example, if you wanted to change the owner for the file index.html to sshah, you would use chown as follows: ...

Get Practical Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.