1 Star 0 Fork 4.9K

丛林 / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
kernel-small-debug-shell-cmd-su.md 2.92 KB
一键复制 编辑 原始数据 按行查看 历史
Annie_wang 提交于 2022-05-19 22:02 . update docs

su

Command Function

This command is used to switch the user account.

Syntax

su [uid] [gid]

Parameters

Table 1 Parameter description

Parameter

Description

Value Range

uid

Specifies the ID of the target user.

  • Left blank
  • [0,60000]

gid

Specifies the ID of the target user group.

  • Left blank
  • [0,60000]

Usage

  • If no parameter is specified, the su command switches to user root by default. The uid and gid for user root are both 0.
  • If uid and gid are specified, this command allows commands to be executed as the user with the specified uid and gid.
  • If the input parameter is out of the range, an error message will be printed.

Example

Run su 1000 1000.

Output

Switching to the user with both uid and gid of 1000:

OHOS # ls
Directory /data/system/param:
-rw-r--r-- 0 u:0 g:0 hello_1.txt
OHOS # su 1000 1000
OHOS # touch hello 2.txt
OHOS # ls
Directory /data/system/param:
-rw-r--r-- O u:1000 g:1000 hello 2.txt
-гw-r--r-- 0 u:0 g:0 hello_1.txt
1
https://gitee.com/jungle8023/docs.git
git@gitee.com:jungle8023/docs.git
jungle8023
docs
docs
master

搜索帮助