Linux file permissions

Source: Internet
Author: User

R W x 4 2 1

[Email protected] ~]# chmod 575 a.txt

[Email protected] ~]# ls-l a.txt

-r-xrwxr-x 1 root root 0 March 19:09 a.txt

# chmod-r 777 xx/Recursive Change permissions

# chmod u=rwx,g=rwx,o=rwx xx a=rwx all +-

# chmod a-w XX

# chown Root:root XX

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>

Cut-d delimiter-F Number selected column-C by character

# who | Cut-b 10-14

Tty1

pts/0

# Who|cut-b 3-

Who|cut-c 3-5

[Email protected] ~]# cat/etc/passwd|head-n 5| cut-d:-F 1

Root

Bin

Daemon

cd/

Lp

Chgrp

# Useradd Yy-g He

$ ll

-rw-r--r--1 XX He 15 March 20:20 a

Permission to delete a file is controlled by the permissions of the parent directory, regardless of the permissions on the file itself

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>

# umask

0022

File 666-022

Catalog 777-022

The average user's umask may not be 002 unless the following conditions are met

# Vi/etc/profile

If [$UID-gt 199] && ["' id-gn '" = "' Id-un '"]; Then

Umask 002

Else

Umask 022

Fi

# Vi/etc/login.defs

UMASK 077 for home directory

Suid sgid Sticky bit permissions

Setuid can allow the normal user to run the root role

# chmod U+S/ETC/PASSWD

-rwsr--r--

# Find/usr/bin-type F-perm 4755 | Xargs ls-l

-rwsr-xr-x. 1 root root 54240 January 2012/usr/bin/at

-rwsr-xr-x. 1 root root 66352 December 8 2011/usr/bin/chage

-rwsr-xr-x. 1 root root 51784 November 2013/usr/bin/crontab

-rwsr-xr-x. 1 root root 71480 December 8 2011/usr/bin/gpasswd

-rwsr-xr-x. 1 root root 36144 December 8 2011/usr/bin/newgrp

-rwsr-xr-x. 1 root root 30768 February 2012/usr/bin/passwd

-rwsr-xr-x 1 root root 27576 September 2013/usr/bin/pkexec

# chown. xx/home/admins/

# chmod 770/home/admins/

# chmod 2770/home/admins/Directory group names are automatically inherited from the following files

# ls-ld/home/admins/

DRWXRWS---2 root xx 4096 March 22:07/home/admins/

# ls-l/home/admins/xxxxx

-rw--w--w-1 root xx 0 March 22:09/home/admins/xxxxx

# chmod 4755 A

-rwsr-xr-x

Setuid 4000 + Setgid 2000 = 6755

-rwsr-xr-x-rwxr-sr-x

# chmod U+s A # chmod g+s a

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>

When coincident with X is the lowercase s.

sbit Sticky bit Permissions 1000 can only be deleted by primary and Root: Sharing files, others can not move other people's things.

# ls-ld/tmp/

DRWXRWXRWT. 3 root root 4096 March 21:46/tmp/

chmod 7755 Test

Chattr +i A cannot be deleted.

Chattr +a A can only be appended

Lsattr

Setfacl Getfacl



Linux file permissions

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.