Get the App
SLTechnology News&Howtos  ›  Servers  › 

How does Linux change the access to a file or directory

Shulou Source: shulou.com Published: 2022-06-01 12:25:20 10月03日 Update

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!

Tags: Files permissions directories commands users administrators syntax management information content subitems subdirectories ownership file names examples errors learning practical deeper interest Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Apple Shulou Information OPPO Reno Docker