Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

User authority and attribution

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Compared with Windowns operating system, the function of user account and group account in Linux system is essentially the same, and they both control access to resources based on user identity, but there are some differences in expression and individual details.

User account number

Superuser: that is, the root user, who has the maximum permissions on this host.

Ordinary users: ordinary accounts need to be created by root users or other administrator users, and their permissions are limited. Generally, they only have complete permissions in the user's own host directory.

Program users: only used to maintain the normal operation of the system or a program, generally not artificially login to the system.

There are two configuration files related to the user account, which are / etc/passwd / etc/shadow. The former is used to store the user name, host directory login shell and other information, while the latter user saves the user's password, account validity and so on. In these two configuration files, each line corresponds to a user account, and different configuration items are separated by colons.

Use the tail instruction to display the last line. In the red box above is the passwd file. The meaning of his configuration section from left to right is as follows.

Similarly, you can also view the / etc/shadow file through tail or the head directive, the meaning of each paragraph in the document is not commented here, Baidu on its own, plenty of food and clothing.

User account management

Each account has a digital identity tag called UID. User account management is mainly accomplished by the following command words.

Useradd command to add user account

Passwd command settings to change user password

Usermod command to modify the attributes of an account

Userdel deletes a user account

Useradd command [options]

The following figure even if you create the user chen instruction host directory / opt/lang

-r Recursive deletion

Group account

Basic group: also known as private group. Generally speaking, when creating an account, the system creates a basic group with the same name for each account by default.

Additional groups: also known as public groups, are generally created by the administrator account to manage user permissions.

There are two configuration files related to the group account, namely / etc/group,/etc/gshadow. The former is used to save the group account name, GID number and other information, followed by the encrypted secret string used to save the group information.

Each basic group also has a group account, called GID, which is accomplished mainly through the following command words

Groupadd add group account

Gpasswd add, set, delete group members

Groupdel deletes a group account

Groupadd command options

-g specify the ID of the group account

Gpasswd option

-an add group members

-d Delete a group member

Groupdel

Also introduce a few simple commands

Id queries the identity of a user's account

Groups query user is the group to which the account belongs

Finger queries the login attributes of a user's account

W query the user login of the current host

File authority and its attribution

Files in Linux system have two attributes: access rights and file owners, which are referred to as permissions and attribution for short. Among them, the access includes three basic types: read, write and executable, and the ownership includes the owner (the user account that owns the file) the group (the group account that owns the file). It is important to note that the root directory is the superuser of the system and has full control.

We use the ls-l command to query the details of the file, including parameters such as the permissions and ownership of the file.

The meanings of the paragraphs of the file in the above picture from left to right are as follows

Setting file permissions, attribution mainly uses two commands: chmod chown

Chmod sets file permissions

Option

U, g, o, a represent owner, group, other users and all users, respectively.

+, -, and = means to add, remove and set permissions, respectively.

R, w and x represent read, write and execute permissions, respectively

The other is to write numbers directly, which is simple and fast.

Chown settings file attribution

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 249

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report