use*_*220 5 linux ubuntu permissions
当我在控制台中输入“runuser”时,我收到“找不到命令”。我虽然这个命令很标准,但我在我的系统上找不到它。
我是 root 用户,但我没有其他用户的密码。
在Ubuntu你su和sudo对这样的事情:
su - username
Run Code Online (Sandbox Code Playgroud)
更改为 user username,就像该用户已登录一样。
sudo -u username command
Run Code Online (Sandbox Code Playgroud)
以 user 身份运行单个命令username。
根据您对其他答案的评论:
当我这样做的时候
su - otheruser,我就得到了No directory, logging in with HOME=/。然后当我跑步时whoami,我明白了root。
发生这种情况是因为“otheruser”没有 shell(如 bash)。它可能类似于 /bin/false。如果您想要一个 shell 作为“otheruser”,请使用以下命令:
sudo -u otheruser /bin/bash
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12855 次 |
| 最近记录: |