Linux Series Tutorials (17)--linux Rights Management File System Properties Chattr permissions and sudo commands

Source: Internet
Author: User

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

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.