Previous blog We described ACL permissions for Rights management, and by setting ACL permissions, we specified a specific permission for a file for a user. In this blog we will introduce more than two commands chattr and sudo used in rights management.
1. Set File System Properties: chattr
chattr [+-=][Options] File or directory name
+: Increase Permissions
-: Delete Permissions
=: equals a permission
Options:
Note: The root user cannot be the exception after chattr restricts permissions. This command prevents the file from being mistakenly manipulated.
2. Viewing the file's system properties: lsattr
Lsattr option file name
Options: ①,-a show all files and directories
②,-D if the directory, only the properties of the list itself, not the child file
3. sudo permissions
The operands of ① and sudo can only be system commands.
②, the command that would otherwise be executed by the Superuser is given to the ordinary user.
Simply put, for example, a lot of commands that can only be executed by superuser, such as rebooting, shutting down, etc., and sometimes not using super users, what should we do?
The first step: the appropriate configuration, so that the super-user to give ordinary users can also execute the permissions of these commands
Step two: Add sudo to execute these commands.
First, the super user gives the ordinary user to execute the command permission, configures the/etc/sudoers file
We can use the Vim/etc/sudoers command, or the Visudo command
Second, authorized users can restart the server
User name all=/sbin/shutdown-h now
Third, view the available sudo commands
Sudo-l
Iv. ordinary users execute sudo-given commands
4. Summary
This blog we introduce the Rights Management two of the most commonly used commands, chattr command can set the system properties of the file, Superuser can also be limited, this command can better protect the file and directory is not destroyed, and another command sudo, Super Administrator gives ordinary users the right to execute system commands, and then through sudo command to execute, because we sometimes do not have superuser access, and then want to use some system commands, then the sudo command can help us.
Linux Series Tutorials (17)--linux Rights Management File System Properties Chattr permissions and sudo commands