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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.