Home  >  Article  >  System Tutorial  >  How to set permissions for files in Linux? Linux file permission setting tips

How to set permissions for files in Linux? Linux file permission setting tips

PHPz
PHPzforward
2024-01-03 19:46:251322browse

If we want to run such a file, we need to add an executable permission to the file separately. How to add an executable file to the file? There are three types of access permissions for files or directories: read-only, write-only and executable. Let's take a look at the detailed operation process.

Linux如何给文件权限? linux给文件添加可执行权限的技巧

Log in to the Linux system and create a new terminal

Linux如何给文件权限? linux给文件添加可执行权限的技巧

Use the touch command in the terminalCreate a file

Linux如何给文件权限? linux给文件添加可执行权限的技巧

Use Vim editor, write some content in the file, enter: wq to save and exit

Linux如何给文件权限? linux给文件添加可执行权限的技巧

Return to the terminal, Use ls -l to view file permissions

Linux如何给文件权限? linux给文件添加可执行权限的技巧

Use the chmod command and the x parameter to give the file executable permissions

The x here represents executable permissions (read, write, and executable permissions are represented by r, w, and x respectively); and the a represents all, which is the three identities of user, user group, and other users. All permission values ​​are modified (if you only modify one of the three identities of user permissions (user), user group permissions (group), and other users (others), you can use u, g or o to replace the letter a); x The plus sign in front means adding permissions (if a permission is to be removed, it will be a minus sign in English).

Linux如何给文件权限? linux给文件添加可执行权限的技巧

In enableUse the ls -l command to view the file permission attributes and you will have executable permissions. You can use the absolute path of the file to run it

Linux如何给文件权限? linux给文件添加可执行权限的技巧

The above is the detailed content of How to set permissions for files in Linux? Linux file permission setting tips. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete