Linux Getting Started Basics (eight) Linux extension permissions

Source: Internet
Author: User
Tags chmod

Default Permissions

Each terminal has a Umask attribute to determine the default permissions for new files and folders

Umask is represented by the use of digital permissions, such as 022

The default permissions for the directory are: 777-umask

The default permissions for files are: 666-umask

Generally, the default umask for ordinary users is the default for 002,root users umask is 022

In other words, for ordinary users:

The permissions for the new file are: 666-002 = 664

The permissions for the new directory are: 777-002 = 775

Command umask to view setting umask values

$ umask View the current umask value. (see there are 4, said later)

$ umask 022 puts the current umask value at even 022

Special permissions

In addition to normal permissions, there are special permissions
With the command umask, you will see that there are 4, each accounted for 3bit, so Linux permissions binary total 12 bits, Ugo accounted for the latter 9 digits, the beginning of 3 bits are special permissions.

For example:

$ ls-l/USR/BIN/PASSWD
Show:

-rwsr-xr-x 1 root root 41284 Apr 9 2012/usr/bin/passwd
The x bit of the U permission turns to S, stating that this file is suid permission


Set special Permissions

Set Suid: $ chmod u+s test

Set Sgid: $ chmod g+s test

Set Sticky: $ chmod o+t test

As with normal permissions, special permissions can also be represented in a digital way
-suid = 4
-sgid = 2
-sticky = 1
So, we can set the following command:
$ chmod 4755 Test

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/

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.