How to use chmod and chown command

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.

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 3 comments… read them below or add one }

1 E. Hill 10.29.06 at 2:59 pm

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

2 somery.van 05.15.08 at 7:53 am

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

3 Derrick 07.01.09 at 7:53 pm

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.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post: Debian or Ubuntu Linux runlevel configuration tool to start service

Next post: RPM database location for backup purpose