1 Star 0 Fork 5K

丛林 / docs

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

su

命令功能

su用于变更为其他使用者的身份。

命令格式

su [uid] [gid]

参数说明

表1 参数说明

参数 参数说明 取值范围
uid 目标用户的用户id值。 - 为空。
- [0,60000]
gid 目标用户的群组id值。 - 为空。
- [0,60000]

使用指南

  • su命令缺省切换到root用户,uid默认为0,gid为0。

  • 在su命令后的输入参数uid和gid就可以切换到该uid和gid的用户。

  • 输入参数超出范围时,会打印提醒输入正确范围参数。

使用实例

举例:su 1000 1000

输出说明

**示例:**切换到为uid为1000,gid为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

搜索帮助