13

I am not familiar with Ubuntu. I copied my project folder in htdocs, then I open my project in browser it loads, but styling files (CSS files) don't load. It is a permission problem. I have done a lot of commands but didn't have any success.

How can I give permission to each and every thing in htdocs?

3 Answers 3

21

You need to change permissions or ownership of htdocs directory. To change the permissions use the chmod command, for example:

$sudo chmod -R 755 /opt/lampp/htdocs

To see who is currently logged user, run:

$whoami

To change the owner use the chown command:

$sudo chown -R username:username /opt/lampp/htdocs

Also, you can use find command to change the permissions only on specific files. For example, to change the permissions on all css files in htdocs directory run the following command:

sudo find /opt/lampp/htdocs -type f -name "*.css"  -exec chmod 755 {} \;
4
  • whoami works for me
    – atom
    Jun 11, 2018 at 4:39
  • The above helped me place wordpress folder and start installation. But the directory was not writable. I had to chmod777 before successfully complete the installation and using the directory inside wordpress.
    – user227495
    Dec 7, 2018 at 11:41
  • I copied mypage.php to htdocs and it has rwx--x--- rights. I see xampp index.html has 644. Where do I set umask so when copying to htcdocs my files shange to 644 rights?
    – Hrvoje T
    Jan 10, 2019 at 13:21
  • you need to do a sudo -i before all
    – amdev
    Jan 28, 2019 at 21:02
1
sudo chown -R daemon wordpress-folder

// or use htdocs folder

the xampp apache server uses a user named daemon to access the folders inside htdocs, this will fix all the permission problems.

0

That's what helped me:

sudo chown -R youruser:youruser /opt/lampp/htdocs

Also you can make changes in httpd.conf file:

sudo gedit /opt/lampp/etc/httpd.conf

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .