• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# chmod
2
3
4## Command Function
5
6This command is used to change file operation permissions.
7
8
9## Syntax
10
11chmod [_mode_] [_filename_]
12
13
14## Parameters
15
16**Table 1** Parameter description
17
18| Parameter    | Description                                                    | Value Range      |
19| -------- | ------------------------------------------------------------ | -------------- |
20| mode     | Specifies the permissions for a file or directory. The value is an octal number, representing the permission of **User** (owner), **Group** (group), or **Others** (other groups).| [0, 777]        |
21| filename | Specifies the file path.                                    | An existing file |
22
23
24## Usage Guidelines
25
26- Specify **mode** to change file permissions.
27
28- For the files created on the FAT file system, the file permission attributes are the same as those of the mounted nodes. Currently, the node permissions include only user read and write. The **group** and **others** permissions do not take effect. In addition, only the user read and write permissions can be modified. The read and write permissions are **rw** and **ro** only. There is no such restriction for other file systems.
29
30## Note
31
32Currently, the shell does not support this command.
33
34## Example
35
36Change the permissions on the **hello-openharmony.txt** file to **644** and **777**.
37
38
39## Output
40
41Modify the permissions on the **hello-openharmony.txt** file in the **/dev** directory.
42
43```
44OHOS:/dev$ chmod 644 hello-openharmony.txt
45OHOS:/dev$ ll hello-openharmony.txt
46-rw-r--r-- 0 0 0 0 1970-01-01 00:00 hello-openharmony.txt
47OHOS:/dev$ chmod 777 hello-openharmony.txt
48OHOS:/dev$ ll hello-openharmony.txt
49-rwxrwxrwx 0 0 0 0 1970-01-01 00:00 hello-openharmony.txt
50```
51