Le 1/25/23 à 3:22 PM, Nicolas George a écrit :
For the current problem:

sudo -u www-data namei /var/www/nextcloud/3rdparty/autoload.php

… will cause the command to be executed in an environment closer to the
one that causes the problem, and therefore is more likely to reveal it.
Use any command of your choice instead of sudo of course.

I only have su on my server,
I have this little bash function in one of my bash rc files.

root#cloud 15:32:53 ~ # type runas_wwwdata
runas_wwwdata is a function
runas_wwwdata ()
{
    echo su - www-data -s /bin/bash -c "$*";
    su - www-data -s /bin/bash -c "$*"
}
root#cloud 15:32:59 ~ # runas_wwwdata  namei -l 
/var/www/nextcloud/3rdparty/autoload.php
su - www-data -s /bin/bash -c namei -l /var/www/nextcloud/3rdparty/autoload.php
f: /var/www/nextcloud/3rdparty/autoload.php
drwxr-xr-x root     root     /
drwxr-xr-x root     root     var
drwxr-xr-x root     root     www
drwxr-xr-x www-data www-data nextcloud
drwxr-xr-x www-data www-data 3rdparty
-rw-r--r-- www-data www-data autoload.php
root#cloud 15:33:03 ~ #


I could have passed www-data as a parameter,
but since it's the only user i need to run commands under for the time being,
defining it that way allows me to type "run"
then <tab>
and then whatever command I need to run.
Saves a couple key strokes.

Best,

--
yassine -- sysadm
+213-779 06 06 23
http://about.me/ychaouche
Looking for side gigs.

Reply via email to