模拟非登录用户的权限

pka*_*mol 2 linux permissions shell file-permissions

我想代表一些非登录用户执行一些操作,例如www-datauwsgi。我的目的是测试一些权限,检查他们可以修改哪些目录等。

除了为它们创建 shell 和密码之外,是否有推荐的方法来解决此问题su

编辑

当我尝试使用以下命令su向特定用户发送信息时sudo

admin@ip-192-10-30-111:~$ sudo su www-data
This account is currently not available.
admin@ip-192-10-30-111:~$ cat /etc/passwd | grep -i www-data
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
admin@ip-192-10-30-111:~$ 
Run Code Online (Sandbox Code Playgroud)

hek*_*mgl 5

您不需要为它们创建 shell 和密码,您只需su以 root 身份--shell运行并使用su.

要运行 bash shell,请执行以下www-data操作:

su --shell /bin/bash www-data
Run Code Online (Sandbox Code Playgroud)

作为根。