Differences between chown and chmod

Source: Internet
Author: User

Chown modify user and user group attributes of files and folders

1. The owner of the HH. c file to be modified. All users whose names are modified to sakia

Chown sakia HH. c

In this way, the user access permission of HH. C is applied to sakia as the owner.

2. Change the owner and group of the/tmp/sco directory to sakia and group net.

Chown-r sawn: net/tmp/sco

Chmod modifies the read/write execution attributes of files and folders

1. Change the HH. c file to writable, readable, and executable.

Chmod 777 HH. c

To modify the attributes of all files in a directory to writable and executable

Chmod 777 *.*

Replace the folder name with the suffix.

Similarly, if you want to modify the attributes of all HTM files

Chmod 777 *. htm

2. Change/tmp/sco directory to writable and readable and executable

Chmod 777/tmp/sco

To modify the attributes of all folders in a directory to writable and executable

Chmod 777 *

Replace the folder name *.

To modify the attributes of all files and folders in/tmp/sco and Their subfolders to writable, readable, and executable

Chmod-r 777/tmp/sco

Writeable W = 4

Readable r = 2

Executable x = 1

777 means that you have full permissions. Users and group permissions can be freely combined as needed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.