Command differentiation between chmod and umask

Source: Internet
Author: User

The chmod command differs from the umask command to change the access permission of the file directory. It is a very heavy system command. You can use it to control access to files or directories. Umask is a default permission for creating a file or creating a file directory. If the umask command without parameters is used, the current umask value is output. [Root @ localhost root] # umask 0022 usually only uses the last three bits (002) for file permissions. Umask is the opposite of the chmod command setting. umask uses a "complement code", while chmod sets the File Permission code. For files, the system does not allow them to be granted executable permissions at the beginning of creation. Therefore, the maximum File Permission is 6 and the directory is 7. The default file creation permission is used to subtract the value of umask from the maximum value. Therefore, when umask is set to 022, the default file creation permission is 644, while the default directory creation permission is 755. Umask is only a command. After the terminal exits, it becomes invalid and needs to be re-run next time. Try/etc/profile ,~ /. Bash_profile, change umask 022 in the/root/. bash_profile file to 002, And the restart terminal does not take effect. Maybe the terminal does not open the execution environment of these files. Finally, find/etc/bashrc and change umask 022 to umask 002.

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.