Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd, 2017 please sign up again. Thanks!

File Permisions - chown

Discussion in 'Linux Beginner Tutorials' started by Rob, Jul 9, 2013.

  1. Rob

    Rob Administrator
    Staff Member

    Oct 27, 2011
    Likes Received:
    The command chown is the chmod's cousin. It is used for changing the ownership rights of a file (hence the name 'chown' - change owner). It does not change the read, write and execution permissions however.

    This command, though available to every user, is probably going to be used when you're working as root. The command is uses like this:

    chown owner.group filename
    Let's say you want to copy something from your Windows partition (if you have one). You mount the partition (as root) and to save time, you copy the file to your user directory /home/bob/. If you type ls -l the_file you'll get something like this:

    -rw-r--r--  1 root    root          2428 Nov 17 13:18 the_file
    As we now know from the previous lesson, root is the owner of the file. Therefore, root is the only one who has write permissions for the file (permission to modify its content). If you plan on working with the file as "bob", there isn't a snowball's chance in hell to modify that file until, as root, you run chown on the file. So let's do it!

    chown bob.bob the_file
    This example presupposes that your Linux version creates groups for each user. There are others that will create a generic group called users for everybody who uses the computer. On a network, groups are created according to the needs of the organization. On your single home computer, just type ls -l and see what system corresponds to you.

    As you can see, 'chown' is absolutely necessary if you're working as more than one user with the computer.

Share This Page