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

How does Linux modify the file owner

2025-01-21 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 how Linux modifies the relevant knowledge points of the file owner. 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. Command format:

The code is as follows:

Chown [options]. [owner] [: [group]] file.

2. Command function:

Change the owner and group of files through chown. You can use the user name and user identification number settings when changing the owner or group to which the file belongs. Ordinary users cannot change their files to other owners. Its operation authority is generally an administrator.

3. Command parameters:

Required parameters:

-c displays the information of the changed part

-f ignore error message

-h repair symbolic links

-R processes all files in the specified directory and its subdirectories

-v displays detailed processing information

-deference acts on the direction of the symbolic link, not on the linked file itself

Select parameters:

-reference= "directory or file" takes the specified directory / file as a reference, and sets the operating file / directory to the same owner and group of the reference file / directory

-from= "current user: current group" changes only if the current user and group are the same as the specified user and group

-help displays help information

-version displays version information

4. Use an example:

Example 1: change the owner and group

Command:

The code is as follows:

Chown mail:mail log2012.log

Output: the code is as follows:

[root@localhost test6] # ll

-xr-r- 1 root users 302108 11-30 08:39 linklog.log

-xr-r- 1 root users 302108 11-30 08:39 log2012.log

-rw-r-r- 1 root users 61 11-30 08:39 log2013.log

-rw-r-r- 1 root users 0 11-30 08:39 log2014.log

-rw-r-r- 1 root users 0 11-30 08:39 log2015.log

-rw-r-r- 1 root users 0 11-30 08:39 log2016.log

-rw-r-r- 1 root users 0 11-30 08:39 log2017.log

[root@localhost test6] # chown mail:mail log2012.log

[root@localhost test6] # ll

-xr-r- 1 root users 302108 11-30 08:39 linklog.log

-xr-r- 1 mail mail 302108 11-30 08:39 log2012.log

-rw-r-r- 1 root users 61 11-30 08:39 log2013.log

-rw-r-r- 1 root users 0 11-30 08:39 log2014.log

-rw-r-r- 1 root users 0 11-30 08:39 log2015.log

-rw-r-r- 1 root users 0 11-30 08:39 log2016.log

-rw-r-r- 1 root users 0 11-30 08:39 log2017.log

These are all the contents of the article "how Linux modifies the file owner". 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.

Share To

Development

Wechat

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

12
Report