Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at chown (rhymes with shown) sometimes pronounced chown (rhymes with clown).
The chown command simply changes a file’s owner or both owner and group. You need to use sudo to do this or be running as root. Try a command like this to make another user the owner of a file you own and you’ll see the problem:
Run the same command with sudo and you should be OK
To change both the owner and group, put the arguments together like this:
If you like, you can copy the owner and group from another file by using the --reference argument:
The chown command also provides an option for recursion. So, if you want to change the owners for all the files in a given directory and below, you would use a command like this:
$ chown -R nemo:fish /home/nemo
That’s your Linux tip for today.
If you have questions or would like to suggest a topic, please add a comment below.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.