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.
Log in to the Linux system and create a new terminal
Use the touch command in the terminalCreate a file
Use Vim editor, write some content in the file, enter: wq to save and exit
Return to the terminal, Use ls -l to view file permissions
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).
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
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!