How to not use sudo in XAMPP? - apache

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.

Related

Giving Apache permission on Joomla folder

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!

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.

vagrant puppet unable to chmod to make executable

I have a vagrant 1.6.3 debian 7.5 with a TYPO3 6.2.9 installation and I'm trying to make a php file executable
chmod a+x typo3/cli_dispatch.phpsh but it's not working - not even as root.
When I log out, however, I see that the file has changed permissions outside in my host machine.
I tried adding
file {'/home/vagrant/docs/typo3/cli_dispatch.phpsh': mode => 0777} to the puppet manifest, but nothing seems to happen.
Can somebody perhaps shed some light on how to make files executable inside the vagrant box?
reson could be the folder you are working with is protected ,
you can try
chattr -i /home/vagrant/docs/typo3/cli_dispatch.phpsh
and try to change permissions again

Change Apache2 ubuntu default page (I can't replace the file!)

I am new into web page making in ubuntu studio.
I downloaded Apache 2, and when I type localhost in my browser I get the Apache2 Ubuntu Default Page, which tells me to replace the index file. But when I try to do it I can't, because there is some sort of permission lock in the var/www/html folder
How do I change this, or how should I proceed?
To change the index.html file you need root permissions. Try to run this command from terminal to edit the file:
sudo gedit /var/www/html/index.html
That will run the gedit under the root user. You can read more about sudo command here http://en.wikipedia.org/wiki/Sudo

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!