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

Linux user and Rights Management

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

Share

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

First, users and user groups

The gods are like the root in our Linux.

(1) Linux file permissions

Unlike the Windows system, in the Linux system, each file adds a lot of attributes, especially the concept of user groups, what is the use of this?

1. The function of system protection

2. The function of team developing software or data sharing

3. Harm if permissions are not set properly

Chgrp: change the group to which the file belongs

Chown: change the file owner

Chmod: change the permissions of the file. Characteristics of SUID,SGID,SBIT, etc.

Change the permission to the maximum permission 777 (r read = 4 ~ w write = 2 ~ ~ x execute = 1)

Symbol type changes file permissions

U: owner

G: belonging to group

O: other

A: all

If I don't know the original file properties, and I just want to increase the permissions that everyone in the .bashrc file can write to, then I can use:

And what if you want to remove permissions without changing other existing permissions? For example, to remove the executable permissions of all people, then:

The meaning of the permissions of directories and files

Default and hidden permissions for files and directories:

The default permissions for directories are (777) and the default permissions for files are (666).

For example:

It turns out it's 022.

Well, if it is a directory, then use 777-022 permissions 755. All permissions of this directory are 755.

The file is 666-022. 644, so the file permission is 644.

As shown in the figure:

Default and hidden permissions for files and directories:

+ I means you can't do anything, which is like locking the directory.

-I means to unlock the directory

View locked directories

File special permissions: SUID=4, SGID=2, SBIT=1. Special permissions must have execute (x) permission in advance.

What is the special function of SUID permissions for a file?

SGID has the following functions

This Sticky Bit, SBIT is currently only valid for directories, but has no effect on files. The role of SBIT for directories is:

For example, our / tmp own permission is "drwxrwxrwt", under which anyone can add or modify files in / tmp, but only the file / directory creator and root can delete their own directories or files. This feature is also very important! You can do a simple test like this:

Will find that shan'bu can not be deleted, you can use sudo (temporarily call root permission to operate)

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: 0

*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