In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to set permissions under Linux to allow users to delete only their own files. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Previously we knew how to set file permissions for users and user groups. Permissions are usually set by three octets, and what I want to say here is that it is actually represented by four octets. We usually ignore the first octal. The second to fourth ones correspond to SUID,SGID,sticky-bit.
SUID: when a file with the SUID bit set is executed, the file will run as the owner, which means that whoever executes the file has the privileges of the file owner. If the owner is root, then the executor has the privileges of the superuser
SGID: when a file with the SUID bit set is executed, the file will have the privileges of the group to which it belongs
The sticky-bit: the sticky bit requires the operating system to keep an image of the executable program in memory even after it exits. This is done to save startup time for large programs. But it will take up system resources. This bit can be understood as anti-deletion bit. When the sticky bit bit is set, even if the user has write permission to the directory, files can only be added and not deleted.
SUID and SGID can set permissions for files, such as rwx (readable, writable and executable).
We have introduced chmod to modify file permissions, as an example:
When we want to make user writable and group writable, the command is as follows:
Chmod upright Grunw myfife
So what is the permission to operate these flags? And file permissions are the same, using chmod to modify permissions.
Chmod Utility myfife: set s permissions for the user, with the permissions of the file owner
Chmod genders Code: set the s permission for the user group, have the permission of the user group, and execute rights on the files in this directory. Code is the directory.
Chmod obtaint myfife: set t permissions for other users, indicating that other users cannot delete them
Have you seen the T in the myfife file? this is because we set permissions for the sticky bit. What is the use of this? Just to prevent deletion. We sometimes encounter that user A has write access to it. After writing, user B thinks that the file is useless and deletes the file. Such a result can be imagined.
In order to avoid the occurrence of the above, there is the introduction of stickiness. It is to prevent other users from deleting it. Only the user can add, modify, delete and so on.
Use chmod 1777 myfife.
Thank you for reading! On "how to set permissions under Linux to allow users to delete only their own files" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.