I have an apache2 server running on ubuntu 16.04, for now everytime i access my project files inside a specific folder i use root user for running php function and edit some files, after i finish i need to run chown -R www-data:www-data .
inside a terminal, because after i run my php function the file owner will become user:user (root:root). what i need is:
- Create new user for my server
- When access my server using ssh this user will be inside a specific folder automatically
- Grant this user a permission to do anything inside this specific folder
For example, Create a user named tonya, when someone access server using user tonya ssh sonya@server.com
, he will be redirected to /var/www/specific_folder, user tonya can do anything inside this folder and when tonya set the php file owner or folder to tonya:www-data
it will work like when i set the file owner to www-data:www-data