To change the ownership of the file mail_test from root to natika, you first have to log in as root because only root can change root's ownership of a file. This is very simple. chown natika mail_test You can also use the -R option to change ownership recursively. Let's use a directory called test_directory as an example. Once again, it belongs to root, and you want to make every file in that directory (and below) owned by natika. chown R natika test_directory The format for changing group ownership is just as easy. Let's change the group ownership of test_directory (previously owned by root) so that it and all its files and subdirectories belong to group accounts: chgrp R accounts test_directory You can even combine the two formats. In the following example, the ownership of the entire finance_data directory changes to natika as the owner and accounts as the group. To do so, you use this form of the chown command: chown R natika.accounts finance_data Quick Tip
So now files (and directories) are owned by some user and some group. This brings us to the next question. |