Umask and chmod

Source: Internet
Author: User

When we log on to the system and create a file that always has a default permission, then how does this permission come from? That's what Umask did. Umask set the user to create the default permissions of the file, it and chmod effect just the opposite, Umask set is the permission "complement", and chmod set is the file permission code. $[HOME]/.BASHRC values can generally be set in/etc/profile,/ETC/BASHRC, $ [Home]/.bash_profile, $[home]/.profile, or umask. Depending on the Linux distribution, such as Fedora19 to change its own umask value, the Umask value added under $[home]/.profile or $[home]/.bash_profile cannot overwrite the value of the/etc/profile configuration. , you must increase the Umask value under $[HOME]/.BASHRC to permanently define your own umask value.


It is well known that X means only if the file is a subdirectory or the file has been set up to perform

If the executable is not set, for the file, there are RW these two items, that is, the largest for 666–rw-rw-rw-

For a folder, the preset is open for all permissions, i.e. 777 drwxrwxrwx


View umask values as direct input umask

-S: Displays the current mask.

user@pcxxxx:~/debug/test$ umask-s

U=rwx,g=rwx,o=rx


You can see the difference between the umask of different users:

root@pcxxxx:~# Umask

0022

root@pcxxxx:/home/user/debug/test1# LL

Total Dosage 12

Drwxr-xr-x 2 root 4096 April 14 16:01./

Drwxrwxr-x User User 4096 April 14 16:00. /

-rw-r--r--1 root 94 April 16:01 Makefile


user@pcxxxx:~$ Umask

0002

user@pcxxxx:~/debug/test$ LL

Total dosage 16

Drwxrwxr-x 2 User user 4096 April 14 15:43./

Drwxrwxr-x user 4096 April 14 15:32. /

-rw-rw-r--1 User User 97 April 15:43 Makefile

-rw-rw-r--1 User User 82 April 15:37 makefile~



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.