I have configured a virtual host with the following commands:
sudo chown -R $USER:$USER /var/www/miweb.com
sudo find /var/www/miweb.com -type f -exec chmod 644 {} \;
sudo find /var/www/miweb.com -type d -exec chmod 755 {} \;
It worked perfect since sftp always uploaded folders with 755 and 644 files inside miweb.com, but a few days ago upload folders like 775 and files like 664.
What can I do so that when I upload via sftp it will be 755 and 644 automatically, and I will not have to change the permissions every time I make a change?
More information:
- I do everything with a non-root user named losito.
- groups losito - > losito sudo www-data
- I connect by sftp with the same user (losito)
- Subsequently I can change permissions by sftp as per command line.
- ls -l /var/www/miweb.com - > drwxr-xr-x 16 elito losito 4096 Sep 27 04:31 miweb.com
- all the files contained in miweb.com are property of elito.
- This all happened to me since I ran an .sh file that contained those commands.
thanks