How to use chmod and chown command

by Vivek Gite on October 11, 2006 · 7 comments

Q. How do I use chmod and chown command under Linux?

A. Use chown command to change file owner and group information. Use chmod command to change file access permissions such as read, write etc.

chown command

chown command changes the user and/or group ownership of each given file.

For example following command will setup user and group ownership to root user only for /backup directory:
# chown root:root /backup
Set user user ownership to root user and allow any member of ftp group to access file.txt (provided that they have sufficient read/write rights).
# chown root:ftp /home/data/file.txt

The information about chmod command is covered in detailed here.

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 7 comments… read them below or add one }

1 E. Hill October 29, 2006

Excellent site!! Your explanations are great. Clear and concise and very helpful! Thanks!

Reply

2 somery.van May 15, 2008

it so good but the result it not enough so i want you add more information.
thank you

Reply

3 Derrick July 1, 2009

don’t know where you got this but all you get is an error that the directory does not exist. so if this script is working for you, then your server is set up wrong and you are riding or borrowed time.

Reply

4 Derrick November 13, 2009

doesn’t work

Reply

5 ubi January 14, 2010

nice lesson =)

Reply

6 sabaresh October 18, 2010

its a good one for the ones who use linux for the first time…..can read and learn

Reply

7 SilverBear May 15, 2011

Good lesson as far as it goes. However:
This command will only work if the file targeted by the command exists. You can’t change ownership of a non-existent file!

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 8 + 8 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the simple math so we know that you are a human and not a script.



Previous post:

Next post: