Giving Apache permission on Joomla folder - apache

I have a Joomla site that the files is owner by root:root. But this way I can't update or install any plugins on Joomla. However when I set de folder's site to the apache owner the site downs return ERROR 500.
How could I fix it?
I've tried set apache owner end set the permissions like below:
chown apache:apache /var/www/html/site
chmod -R 755 /var/www/html/site
Ps.: The site was migrated from another server where the owner of the files is the apache.

Simply run apachectl -S as root or sudo (sudo apachectl -S) and look at the lines which tell User and Group owner.
Other solution, typing the command ps faux will tell you what you need at first column the owner of the process you want to know about.
Also, htop command could help you as same as before if it is installed.
EDIT :
you can also specify -R to do recursive with chown command

I found out the solution. Was just the permissions on files the problem. I don't know why, but when I moved the files of site to another server the folders change the permissions 755 to 655. Changed this permissions everything cames back to normal.
Thanks again!

Related

How to not use sudo in XAMPP?

I am using XAMPP on Ubuntu 20.04. It has been installed at the location opt/lampp/ location.
As usual before writing any code I am saving my php file within opt/lampp/htdocs location.
Now, every time I make changes to any file or want to save it I have to use the command line with sudo and obviously type my password again and again and again.
Could there be a way around this?
And not install xampp in root directory or but some other directory which is not within root directory?
Thank you.
I have found a solution to the problem. Now I can create files with in the specific folder of htdocs.
My location of installation of xampp was default one opt/lampp
Go the parent folder of htdocs that is /lampp and type
sudo chown -R $USER:$USER ./htdocs
Now go to the parent folder of ./lampp and type
sudo chmod -R 755 ./lampp/
Here what we basically did was change the permission to create folder and make changes to the file to the location where we have installed xampp.

Docker wrong permission apache2

I have a problem whith my installation of docker. When I launch my docker-compose up I have this error :
front_1 | /var/lock/apache2 already exists but is not a directory owned by www-data.
front_1 | Please fix manually. Aborting.
I have this error because I add this line in my dockerfile conf :
RUN usermod -u 1000 www-data
But if I delete this line, my symfony project doesn't work with docker.
Do you have any ideas to solve my problem ?
Best regards
As I see it, you are trying to change UID of user www-data inside docker to have the same ID as host machine user UID (you), so you can open project files in your IDE.
This introduces file permissions problems on apache2 service, which can't read it's own files (config, pid,...), simply because it is not the same user anymore.
Quick 'dirty' solution is to change only owner of symfony project files to UID 1000, but keep group (GID) to the www-data. This applies only for dev machine. Else you don't needed it. Run command inside container.
chown -R 1000:www-data /home/project
You can create some bash alias inside docker to have it at hand.
Other option is to use ACL which will set existing files and folder with permissions, which will get inherited to newly created files under given folder. This could be put to bootstrap script inside container. But only for DEV mode. This way you won't need to run chown.
chown -R 1000:www-data /home/project #set for existing files
/usr/bin/setfacl -R -m u:www-data:rwx -m u:0:rwx -m u:1000:rwx /home/project
/usr/bin/setfacl -dR -m u:www-data:rwx -m u:0:rwx -m u:1000:rwx /home/project
Each -m is for a different user. First is www-data (apache2), second is 0 (root) and third is 1000 (you).
Remember UID can change anytime. So this could create security hole if mentioned users are not having proper UID.
I used second method only for folders, where PHP via apache2 sets permissions (uploaded files, cache,...), but host user needs to access these files.

File permission in var/www/html/index.html?

I'm running Ubuntu 14.04 and I'm trying 2 get apache2 working. I've just installed apache2 and want to edit var/www/html/index.html however it says I do not have permission to edit or delete. I tried doing sudo chmod 755 index.html and it has given me permissions but the file still doesn't allow me to edit or delete it.
I needed to be under root so doing su then doing chmod 666 index.html as mentioned in the comments.
I had this issue when trying to re-access a /var/www/html/index.html file (SSH into a Raspberry Pi). I realised once I changed ownership/write rules via chown command it would consequently not allow me access unless I added sudo i.e. sudo nano /var/www/html/index.html.

Impossible write into the AJXP_DATA_PATH folder ajaxplorer

I uploaded ajaxplorer "pydio-core-5.0.4.zip" to my server and after I extracted files into a folder in the server i request the folder to starting install but i get this message :
"Impossible write into the AJXP_DATA_PATH folder: Make sure to grant write access to this folder for your webserver!"
i made the folder : /data permissions to 777 and it did not make change ..
any solve ?
I'v got the same problem few hours ago.
The problem:
You put full permissions (777) to the data folder, but subfolders don't get it.
The solution:
sudo chmod -R 777 data
sudo chmod -R 777 data
or
sudo mkdir -m 777 your_pydio_path/data/tmp/sessions
I know this is old, but I was having the same issue with pydio-core-6.0.8. Also, I'm going to preface this by saying that I am a php noob. But I was able to resolve my issue without a chmod 777 command. Instead, I made the nginx user the owner of the data directory.
chown -R nginx /path/to/pydio-core-6.0.8/data
And then made sure that php-fpm was running as the nginx user with the two php-fpm.conf settings
listen.owner = nginx
user = nginx
After restarting php-fpm, I was able to load the pydio page which went into the startup wizard.
This command is so easy! But it's dangerous!
Go to /var/www/pydio for apache2 or /usr/share/nginx/html/pydio for nginx and try:
chmod ugo+x data
It's more protected!

How to get permission to edit the file apache2.conf? [Ubuntu]

I'm a beginner Ruby on Rails Programmer and I'm trying to install Apache2 + Passenger(That's for Rails Deployment).. and at the end of the installation process, Passenger gave me a few lines to add to the file apache2.conf at /etc/apache2/ but I can't override this file.. I have no permission =( I've also uploaded an image showing me the error.
P.S => I'm logged into Ubuntu with my username and password.
Please help! and thanks,
Rodrigo.
The simplest way is to open the file with the sudoedit program, as in
sudoedit /etc/apache2/apache2.conf
which will prompt for your password and then open your editor.
After the installation has completed, add phpmyadmin to the apache configuration.
sudo nano /etc/apache2/apache2.conf
Add the phpmyadmin config to the file. Include
/etc/phpmyadmin/apache.conf
Restart apache:
sudo service apache2 restart
If you are a beginner in GNU/Linux, I want to notice, for run command with root privileges run it with sudo:
sudo <your_command>
If you want to get root privileges for current terminal session (no need to type sudo each command) run:
sudo -i
I hope this will help someone considering the number of years since the last post. I tried this, and it worked for me.
sudo bash
Then the command to edit. Then save the file. Below is the site I got the procedure from.
https://ubuntuforums.org/showthread.php?t=1845306
Enter the command:
sudo nano /etc/apache2.conf
Or you can use the following chmod 777 usr/local/apache2/conf/httpd.conf
this will enable you to read/write the config file but be warned if you are planning on putting apache2 online you must revert it back to the old permissions chmod 640 usr/local/apache2/conf/httpd.conf