Linux Rights Management Command Chown, CHGRP, Umask, Linux new file or directory default permissions 755

Source: Internet
Author: User

Chown/bin/chown
chown [user] [file or directory] to change the owner of a file or directory
Only root can change the owner of a file or directory

Root User:
Mkdir/tmp
Touch/tmp/test.file
Useradd MEINV
passwd MEINV
Chown Meinv/tmp/test.file

MEINV Users:
Touch/tmp/test.file1
Chown Root/tmp/test.file1 failed

Chgrp/bin/chgrp

CHGRP [user Group] [file or directory] change the owning group of a file or directory

Groupadd Student
Chgrp Student/tmp/test.file

Umask

Syntax: umask [-S]-s displays default permissions for new files or directories in rwx form
Shell built-in command execution permissions: all Users
Display, set default permissions for files

Umask-s
U=rwx,g=rx,o=rx
Indicates that a new file or directory is now created, and the default permission for this new file or directory is U=rwx,g=rx,o=rx
Umask
0022
777-022=755

mkdir TestDir
Touch testfile
LS-DL TestDir Testfile
Drwxr-xr-x. 2 root root 4096 August 22:13 TestDir
-rw-r--r--. 1 root root 0 August 22:13 testfile
The file is less than the directory x permissions, all new files in Linux do not have permission to execute by default

Set Umask
rwxr-xr--754777-754=023
Umask 023
mkdir test2
Ls-ld test2
DRWXR-XR--. 2 root root 4096 August 22:24 test2

In Linux, the default permission for creating a new file or directory is 755, and the file has fewer executable permissions, which can be viewed through umask

Linux Rights Management Command Chown, CHGRP, Umask, Linux new file or directory default permissions 755

Related Article

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.