In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to change the users and groups of files in Linux. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
In Linux, we can change the owner and group of files by using the Chown command.
In Linux, when you create a file, the owner of the file is the user who created the file. The user of the file can modify the owner and user group of the file, or under root users, this can modify the owner and user group of any file.
The chown command has many uses. You can use the chown command to change the owner of the file, and you can also change the name of the user group directly by the way.
Note: the user must already exist in the system, that is, it can only be changed to a user name that is recorded in the / etc/passwd file.
Let's take a look at how to use the Chown command to change the users and groups of files.
1. Change the owner of the file
First, let's use the ls-l command to check the ownership of the file, for example:
# ls-l tmpfile-rw-r-r-- 1 himanshu family 0 2019-03-30 11:03 tmpfile
Let's use the chown command to change the owner of the tmpfile file
# chown root tmpfile
Then use the ls-l command to check the ownership of the tmpfile file
# ls-l tmpfile-rw-r-r-- 1 root family 0 2019-03-30 11:04 tmpfile
It can be seen that the owner of the tmpfile file, bug "himanshu", has become "root".
2. Change the filegroup
You can also change the group (the group to which the file belongs) through the chown command.
Use the following command to change the group to which the file belongs:
# chown: root tmpfile
Then use the ls-l command to check the ownership of the tmpfile file
# ls-l tmpfile-rw-r-r-- 1 root root 0 2019-03-30 11:04 tmpfile
You can also directly change the owner and group of the file to root at one time, using the following command:
# chown root:root tmpfile's ways to change the users and groups of files in Linux are shared here. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.
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.