Networking / Beginners

Commands for Managing Ownership and Permissions

This section presents the details of the chown and chmod commands, which are the essential tools for assigning file system rights in the Linux environment. You can view the ownership and permissions for a file using the ls command with the -l option.

The chown command

The chown command changes the owner of a file. Normally, the user who creates a file is the owner of the file. However, the owner can transfer the file to someone else via this command. The basic syntax of this command is

chown user file

For example, to change the owner of a file named rescue.plans to user professor, use this command:

$ chown professor rescue.plans

To change ownership of all the files in the directory named /home/island to professor, use this command:

$ chown professor /home/island

Tip Issuing the following command would be a really bad idea:

$ chown gilligan rescue.plans
[Previous] [Contents] [Next]