Common commands for Ubuntu permission management
Common commands for Ubuntu permission management
1. chmod
Method 1
Chomd [{ugoa} {+-=}{ rwx}] [file or directory]
U indicates the user to which the file belongs.
G indicates the user group to which the file belongs.
O represents a visitor
A Represents all users
+-= Add permissions, reduce permissions, or grant permissions respectively
Grant all users the write permission to the t2.tmp file:
Method 2:
Chmod [mode = 421] [file or folder]
4 indicates read permission
2 indicates write permission
1 indicates the execution permission
For example, if the user of a file has all permissions, the group has read and execution permissions, and others have execution permissions, you can set the permission as follows:
Rwx:
2. chown [target user] [file or folder]
Change the owner of a file or directory
Change the t2.tmp file owner to lenve
3. chgrp [user group] [files or directories]
Change the group of a file or directory
4. umask [-S] specifies the default permission mask when a file is created. -S indicates the permission mask in rwx format.