Find The Web Server User:
The first step to finding the web server user in Apache or Nginx server, go ahead and ssh
to your server by using terminal
and run the below command:
Apache Server
sudo ps aux | egrep '(apache|httpd)';
You should get an output similar to this:
www-data 19760 0.0 4.5 349176 46152 ? S 07:59 0:00 /usr/sbin/apache2 -k start www-data 20008 0.0 0.8 342060 8912 ? S 08:07 0:00 /usr/sbin/apache2 -k start root 20120 0.0 0.0 14992 976 pts/0 S+ 08:08 0:00 grep -E --color=auto (apache|httpd)
This output clearly says that Apache is running by www-data, so you get your webserver user.
Nginx Server
sudo ps aux| grep nginx
You should get an output similar to this:
root 139271 0.0 0.0 66580 1800 ? Ss 15:18 0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; www-data 139272 0.0 0.1 66820 5540 ? S 15:18 0:00 nginx: worker process www-data 139273 0.0 0.1 66820 5540 ? S 15:18 0:00 nginx: worker process
This output clearly says that Apache is running by www-data, so you get your webserver user.