Skip to content

Instantly share code, notes, and snippets.

@ibrahimtuzlak0295
Created February 4, 2018 13:54
Show Gist options
  • Save ibrahimtuzlak0295/5332ff369393bf8f35d2650cdee02fe1 to your computer and use it in GitHub Desktop.
Save ibrahimtuzlak0295/5332ff369393bf8f35d2650cdee02fe1 to your computer and use it in GitHub Desktop.
Apache htdocs permissions after installing XAMPP on Linux

After installing XAMPP on Linux, the htdocs folder (default: /opt/lampp/htdocs) can only be written to by root. Although this is normal since the installer has been executed as root, we would still like to be able to create, edit, and remove content from htdocs within our file manager or text editor, without the need for sudo.

Requirements:

  • XAMPP installed
  • sudo

Note: The steps below are done on Ubuntu 16.04, but they should also work on any other Linux distribution.

Warning: These permissions are safe on local environments such as XAMPP. I do not recommend using this for production.

First we need to check what username should have the ownership. The command whoami returns the current logged in user:

$ whoami
ibrahim

or

$ echo $USER
ibrahim

Based on the results above the command should be:

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

Now we can write to htdocs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment