O'Reilly logo

Practical Linux by Bill Ball, John Ray, Michael Turner, M. Drew Streib

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required