I have a project that whenever I go up for production or change of development machine I copy and paste the whole folder, but every time I do this I have to give permissions in this folder and in some sub-folders.
I would like to create a script
to do this automatically, someone knows how to help me.
Scenario: I copy the projeto
folder into my /var/www
give permissions for this project.
sudo chmod 755 /var/www/projeto -R
# dai me pede a senha de root, eu digito e ok
# dai eu tenho que alterar outras permissões de outras pastas para escrita
sudo chmod 777 /var/www/projeto/uploads -R
sudo chmod 777 /var/www/projeto/logs -R
I think it's simple, but I do not have much idea, because I'm thinking of calling this shell to pass the project path where it will give those permissions and I do not know if it's okay to pass in the root password.
I think it would be something like this:
#!/bin/sh
#dar permissoes necessarias
PASTAPROJETO=$1
sudo chmod 755 '$PASTAPROJETO' -R
sudo chmod 777 '$PASTAPROJETO'/uploads -R
sudo chmod 777 '$PASTAPROJETO'/logs -R