I want to perform some actions on behalf of some non-login users, such as e.g. www-data
or uwsgi
. My purpose is to test some permissions, check what dirs they can modify etc etc.
Is there a recommended way of going about this, other than creating a shell and password for them and su
?
edit:
When I try to su
to the specific user with 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:~$
Advertisement
Answer
You don’t need to create a shell and password for them, you can simply run su
as root and use the --shell
argument of su
.
To run a bash shell as www-data
run:
su --shell /bin/bash www-data
as root.