1e41f4b71Sopenharmony_ci# su 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ci## Command Function 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ciThis command is used to switch the user account. 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci## Syntax 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_cisu [_uid_] [_gid_] 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci## Parameters 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci**Table 1** Parameter description 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci| Parameter| Description| Value Range| 19e41f4b71Sopenharmony_ci| -------- | -------- | -------- | 20e41f4b71Sopenharmony_ci| uid | Specifies the ID of the target user.| - Left blank<br>- [0, 60000] | 21e41f4b71Sopenharmony_ci| gid | Specifies the ID of the target user group.| - Left blank<br>- [0, 60000] | 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci## Usage Guidelines 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci- If no parameter is specified, the **su** command switches to user **root** by default. The **uid** and **gid** for user **root** are both **0**. 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci- If **uid** and **gid** are specified, this command allows commands to be executed as the user with the specified **uid** and **gid**. 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ci- If the input parameter is out of the range, an error message will be printed. 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci## Example 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ciRun **su 1000 1000**. 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci## Output 39e41f4b71Sopenharmony_ci 40e41f4b71Sopenharmony_ciThe user with both **uid** and **gid** of **1000** is switched. 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ci``` 43e41f4b71Sopenharmony_ciOHOS # ls 44e41f4b71Sopenharmony_ciDirectory /data/system/param: 45e41f4b71Sopenharmony_ci-rw-r--r-- 0 u:0 g:0 hello_1.txt 46e41f4b71Sopenharmony_ciOHOS # su 1000 1000 47e41f4b71Sopenharmony_ciOHOS # touch hello 2.txt 48e41f4b71Sopenharmony_ciOHOS # ls 49e41f4b71Sopenharmony_ciDirectory /data/system/param: 50e41f4b71Sopenharmony_ci-rw-r--r-- O u:1000 g:1000 hello 2.txt 51e41f4b71Sopenharmony_ci-гw-r--r-- 0 u:0 g:0 hello_1.txt 52e41f4b71Sopenharmony_ci``` 53