Home> System Tutorial> LINUX> body text

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

PHPz
Release: 2024-01-03 19:46:25
forward
1301 people have browsed it

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 thetouch 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 thechmod 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给文件添加可执行权限的技巧

InenableUse 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!

source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!