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 > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will share with you the relevant knowledge points about how to set file permissions in the Linux system. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
1. There are seven file types: d directory l symbolic link (soft and hard connection) s socket file b block device file c character device file p named pipe file-ordinary file, or, more accurately, files that do not belong to the above types 2, file permission settings chmod [who] operator [permission] filename
The meaning of who:
U file belongs to sovereignty limit g same group user rights o other user rights an all users (u+g+o)
The meaning of operator:
+ add permissions-cancel permissions = set permissions
The meaning of permission:
R read permission w write permission x execute permission t sticky bit * l to lock the file, making it impossible for other users to access u.g.o operations for file owners, same group users and other users
Sticky bit "t" if the "t" bit appears on a directory, it means that only the owner of the directory can be deleted; if it appears in the file list, it means that the script or program will be placed in the swap area (virtual memory) when executed.
Modify permissions (symbol mode):
Chmod Uprix hello.pychmod + w hello.pychmod-R + x runall.sh:-R indicates recursive modification, including the sub-files under this folder
Modify permissions (absolute mode, different numbers represent different permissions):
Chmod 664 hello.pychmod 777 *
In absolute mode, the permission to modify should have four digits. 664 is actually 0664. The first bit is to set suid and guid. Once this bit is set, a s:suid (permission number 4) appears on the executable permission bit x, which means that if a user sets this permission on his own shell script, other users will have the corresponding permissions of their owners when executing the script. Guid (permission number 2) means that the user executing the corresponding script will have the permissions of the user in the user group to which the file belongs.
Modify the file to which it belongs:
Syntax: chown-R-h owner file
-R means to make the same changes to files in all subdirectories;-h means that changing the owner of a symbolic link file does not affect the target file that the link points to.
Chown root hello.py: change the ownership of the hello.py file to root
Modify the group in which the file belongs:
The syntax is similar to chown
Chgrp root hello.py: change the group of hello.py files to root
Create file default permissions:
The umask command determines the default permissions for creating files. Generally, umask is set in the / etc/profile file, which is referenced by each user when logging in. If umask is set, it can be saved in the .profile or bash_profile file under $HOME.
These are all the contents of the article "how to set the file permissions of the Linux system". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
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.