Permissions and command execution permissions in Linux

Source: Internet
Author: User
Article Title: Linux system permissions and command execution permissions. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Permission

The permissions of a file are divided into three types: r (readable), w (writable), and x (executable). A file can be assigned to users and groups, set permissions for other users or groups.

This permission management method is flexible, simple, rigorous, and clear. However, in the initial stage, there may be a slight discomfort. Because it is ubiquitous, and the Windows permission management you are used to is not like this (it is very messy, most of the time is like a false one, and occasionally used, it can be a headache ).

Use the chmod command to change the object ACL and chown to change the object ownership. For example:

Chmod 755 xxx

Chmod a + x xxx

Chown user: group xxx is used to change the owner user of a file. You can also change the owner group of a file.

Chgrp group xxx

The 755 and a + x Statements in the preceding command are used to change the owner group of a file.

Command Execution permission

Some commands can be executed by common users, but only the root user can successfully execute them. Why?

For example, add a new user useradd in the system.

Ls-l/usr/sbin/useradd:

-Rwxr-xr-x 1 root 56156/usr/sbin/useradd

Can all users perform this operation?

This is because the useradd command is a tool for modifying the/etc/passwd file. Let's take a look at this file:

Ls-l/etc/passwd-rw-r -- 1 root 1835 2007-11-01 16: 04/etc/passwd

It turns out that only the root user can write the Modification result, and the non-root user will certainly not execute the useradd command.

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.