Commands to give total permissions to a folder

0

Good morning.

I need that please put the commands to me so that a folder that by default does not allow to create nor to eliminate anything in its interior, allows it. I have Ubuntu Mate, and I am practicing with PHP in my localhost, but when I try to create a text document with the FOPEN function it says "permission denied". I came to the conclusion that the problem is not PHP but LINUX. And also please the commands to reset it for when I finish my practices. Is it unsafe to do this? Could someone enter my local host from the internet or not? Thanks.

    
asked by cass 19.10.2017 в 01:00
source

1 answer

1

On Linux to change the permissions use.

chmod -R 777 / var / www / htdocs

However it is better practice to change the owner of the folder. So that it belongs to Apache and the group to you or to the development group.

chown -R www-data: tugroup / var / www / htdocs

Assign permissions to the owner.

find / var / www / htdocs -type d - exec chmod u + r-w + x {} \; find / Var / www / htdocs -type f -exec chmod u + r-w-x {} \;

Now to the folders where php needs to create files.

Do.

chmod -R u + w / var / www / htdocs / upload

And the permissions for your group.

chmod -R g + rwxs / var / www / htdocs find / var / www / htdocs / -type f-exec chmod g-x {} \;

    
answered by 19.10.2017 в 07:00