Since a while ago I decided to say goodbye to Windows and start my journey in Linux. So far everything has been great. but when it comes to the permissions I am a little overwhelmed.
I am running a LAMP Stack with multiple CraftCMS installations. Everything works fine, but I am unable to execute CraftCMS's command line tools. Because I do not have the required permissions.
I do however understand where this comes from. Let me explain my setup:
My document root is living in
Due to the fact that I have my document root in my home folder and not in
/var/www/ the user that runs apache doesn't have acces to my document root.
I solved this by making the user
www-data the owner of
/home/mike/websites/. I did this by running
sudo chown -R www-data /home/mike/websites/
The websites work fine at this point, but I don't have access myself. To fix this I added myself to the group
www-data, with the command:
sudo usermod -a -G www-data mike
This is the point where we are now. Almost everything works fine and I can acces everything as i should.
When trying to run
/home/mike/websites/websiteA/ I get an error :
bash: ./craft: Permission denied
If I run the command with sudo permissions
sudo ./craft I get the error :
sudo: ./craft: command not found
The only way I can get it to work is by using
sudo php ./craft. But that's a bit tedious.
I do however have an idea why: When I write a php command in the console it will be executed by my user. Which probably doesn't have Php permissions to this folder.
Now, How do I fix this? Or should I move my document root to
What is the right way?
ls -l craft output:
-rwxrwxr-x 1 www-data www-data 577 apr 30 11:02 craft