Differences between CentOS commands usermod, chown, and chmod

Source: Internet
Author: User

Differences between CentOS commands usermod, chown, and chmod

For Linux beginners, I often confuse the differences between chown and chmod. This blog is for reference.
Usermod is used to modify the UID, GID, and groups of a user. Usage:

Usermod-u 9999 testuser // change the UID of testuser to 9999 usermod-g 9999 testuser // change the GID of testuser to 9999 usermod-G 9999 testuser // change the additional group of testuser change to 9999

Chown is used to modify the user and group of a file. Usage:

Chown-R root: root/tmp/tmp1 // The-R parameter simultaneously modifies the user and group of the subdirectory.

Chmod is used to modify the access permissions of files or directories.-RwxrwxrwxColumn. Usage:

Chmod [-Rf] u + w file name // Add write permission to the user owner chmod [-Rf] 777 file name // grant 777 permission to the file

Operation object

Operation object meaning "user" in the utable, that is, the owner g of a file or directory represents "same group users ", that is, all users with the same group ID as the file owner o Represents "other users" a represents "all users ". It is the default value of the system.


Operation symbol

Operation symbol meaning + Add a permission-cancel a permission = grant a given permission and cancel all other permissions (if any)


Permission

Permission symbol meaning r readable w writable x executable

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.