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