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 change the access to a file or directory

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

Share

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

This article mainly explains "how Linux changes the access rights of files or directories". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's take you to learn how to change the access rights of files or directories in Linux!

Syntax:

chmod [command switch] [MODE] filename

file permissions

#File permissions 0 No permissions 1 Execute only permissions 2 Write only permissions 3 Execute and write permissions 4 Read only permissions 5 Read and execute permissions 6 Read write permissions 7 All permissions

Command switches:

-c Displays only the names of files whose access rights have been changed. - f disable most error messages-R recursive change files and subdirectories-v output version information and exit.

Examples:

View your files, regardless of access:

ls -alt

You can use this command to view your files regardless of the access rights they have.

Gives groups and other users read and write access to files.

chmod 066 file1.txt

Allows all users to have read, write, and execute permissions on files.

chmod 777 file1.txtchgrp command

The chgrp command is used to change the group to which a file or directory belongs. This is an administrator order. Only administrator users can change the group to which a file or directory belongs.

Syntax:

grammar is

chgrp [command switch] new group filename/directory name

Command switches:

-R Change permissions on files in subdirectories of your current directory. - c Change permissions for each file. - f Mandatory. No mistakes reported.

Examples:

chgrp hiox test.txt

This 'test.txt' file group is the admin group, changed to the new group hiox.

chgrp -R hiox test

This 'test' file directory group is the root directory. With the parameter-R, files and subdirectories of files are changed to the new group hiox.

chgrp -c hiox calc.txt

The above command is only used to change the group of specified files ('calc.txt ').

At this point, I believe that everyone has a deeper understanding of "how Linux changes the access rights of files or directories," so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

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