Give Apache permission to access directories

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
johnnya23
Level 1
Level 1
Posts: 48
Joined: Fri Mar 09, 2018 10:06 am

Give Apache permission to access directories

Post by johnnya23 »

Set up folders per this model:
https://prognotes.net/2016/08/configuri ... velopment/

Only issue (I think) is I can't give apache permission to access the directory:
/home/john/websites/

and all sub-dirs.

thx,
john
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Give Apache permission to access directories

Post by catweazel »

johnnya23 wrote: Thu Mar 22, 2018 10:12 pm I can't give apache permission to access the directory:
/home/john/websites/

and all sub-dirs.
Use this as a guide. Failing that, try this, or this.

As you can see, there are different approaches so you may have to do a bit more digging.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
kukamuumuka

Re: Give Apache permission to access directories

Post by kukamuumuka »

An easy way is to make a symbolic link.

Code: Select all

sudo ln -s /home/john/websites /var/www/html
viewtopic.php?f=47&t=265925#p1445769
johnnya23
Level 1
Level 1
Posts: 48
Joined: Fri Mar 09, 2018 10:06 am

Re: Give Apache permission to access directories

Post by johnnya23 »

Thanks so much for your replies. Not sure what my problem is.. other than I'm not that bright.

I used this:
sudo ln -s /home/john/websites /var/www/html

and now have a wordpress site up and running in /home/john/websites/plugintest

but now when I try to update or install a plugin I get:
Installation failed: Could not create directory.

This is strictly a local development environment so I would like apache to have the access it needs -- and I need access to all files (including new folders added by Wordpress) within /home/john/websites to make edits using Atom.
thanks again for your help
john
kukamuumuka

Re: Give Apache permission to access directories

Post by kukamuumuka »

johnnya23 wrote: Fri Mar 23, 2018 11:19 am but now when I try to update or install a plugin I get:
Installation failed: Could not create directory.
Add yourself to the www-data group.

Code: Select all

sudo adduser john www-data
Set ownership.

Code: Select all

sudo chown www-data:john -R /home/john/websites
johnnya23
Level 1
Level 1
Posts: 48
Joined: Fri Mar 09, 2018 10:06 am

Re: Give Apache permission to access directories[solved]

Post by johnnya23 »

FANTASTIC! perfect. Thanks,
John
Locked

Return to “Beginner Questions”