Permissions issues moving an Apache DocRoot

Post Reply
gilray4
Posts: 17
Joined: Wed Mar 20, 2019 8:33 am
languages_spoken: english
ODROIDs: XU-4
Has thanked: 0
Been thanked: 2 times
Contact:

Permissions issues moving an Apache DocRoot

Unread post by gilray4 » Mon Nov 18, 2019 10:43 am

I have installed Apache and it started up fine.
Then I decided I would like to move the DocRoot.

Om my XU4 I have an eMMC with my boot files.
most everything else, is on the micro SD card.

Under /media/gilray4 I created storage/www

I edited and saved the:
/etc/apache2/apache2.conf

# Just trying trial and error
#to move the doc root to media/storage
#This is the default~
#<Directory /var/www/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory>

<Directory /media/gilray4/storage/www/>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Require all granted
</Directory>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
as well as the:
/etc/apache2/sites-available/000-default.conf

ServerAdmin webmaster@localhost
DocumentRoot /media/gilray4/storage/www
(and just left the default commented out)
#DocumentRoot /var/www/html

This ^ seems to work with the exception of localhost now denies due to permissions.

I have tried a number of things but before I get to wild and bugger something I can't undo I thought I better come ask advice. What is the best usr and group permission settings to allow a page load ?

User avatar
mad_ady
Posts: 6858
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 235 times
Been thanked: 177 times
Contact:

Re: Permissions issues moving an Apache DocRoot

Unread post by mad_ady » Mon Nov 18, 2019 3:02 pm

The folders in /media/.../storage/www need to have r-x permission for the apache/www-data group. Either put them in that group or set the other permissions to r-x.
Show us

Code: Select all

ls -ld /media
ls -ld /media/g*4
ls -ld /media/g*4/storage
ls -ld /media/g*4/storage/www

gilray4
Posts: 17
Joined: Wed Mar 20, 2019 8:33 am
languages_spoken: english
ODROIDs: XU-4
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Permissions issues moving an Apache DocRoot

Unread post by gilray4 » Sun Nov 24, 2019 1:53 am

Sorry it took a bit to get back to this.

I ran each line of those cmd's:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gilray4@odroid:~$ ls -ld /media
drwxrwxr-- 5 root www-data 4096 Mar 19 2019 /media

ilray4@odroid:~$ ls -ld /media/gilray4
drwxrwxr--+ 3 gilray4 www-data 4096 Nov 23 10:59 /media/gilray4

gilray4@odroid:~$ ls -ld /media/gilray4/storage
drwxrwxrwx 1 gilray4 gilray4 131072 Dec 31 1969 /media/gilray4/storage

ilray4@odroid:~$ ls -ld /media/gilray4/storage/www
drwxrwxrwx 1 gilray4 gilray4 131072 Nov 22 16:38 /media/gilray4/storage/www
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#among many others I am a member, as is odroid of the group www-data

gilray4@odroid:~$ getent group | grep gilray4

www-data:x:33:gilray4,odroid

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I can chmod my www dir but the terminal refuses to let me
change the group from 'gilray4' to 'www-data'

I have tried it as gilray4, as 'sudo' and still denied ?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T.Y for your help mad_ady :)

User avatar
mad_ady
Posts: 6858
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 235 times
Been thanked: 177 times
Contact:

Re: Permissions issues moving an Apache DocRoot

Unread post by mad_ady » Sun Nov 24, 2019 5:18 am

Permissions look good. What does /var/log/httpd/access_log and error_log say when you tryy to access the page?
Do you have virtual hosts configured?

gilray4
Posts: 17
Joined: Wed Mar 20, 2019 8:33 am
languages_spoken: english
ODROIDs: XU-4
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Permissions issues moving an Apache DocRoot

Unread post by gilray4 » Sun Nov 24, 2019 7:36 am

mad_ady
My path to the logs is
/var/log/apache2 but no worries. From my 'error.log.1' :

[Tue Nov 19 19:11:52.966341 2019] [core:error] [pid 3659] (13)Permission denied: [client ::1:36864] AH00035: access to / denied (filesystem path '/media/gilray4/storage') because search permissions are missing on a component of the path
[Tue Nov 19 19:11:53.102251 2019] [core:error] [pid 3659] (13)Permission denied: [client ::1:36864] AH00035: access to /favicon.ico denied (filesystem path '/media/gilray4/storage') because search permissions are missing on a component of the path
~~~~~~~~~~~~~~~~~~~~~~~~~

So this is a linux file permissions question I have:
let's say a file permissions that allow user and group to RWX...
But on the path from application to another part of the directory.
what if along that path there is not permission granted for the user to WX and no group assignment other than user >
Can the application still execute a file down this path ?
~~~~~~~~~~~~~~~~~~~~~~~~~

I am looking back at the last thing you showed me:
#1. ls -ld /media
#2. ls -ld /media/g*4
#3. ls -ld /media/g*4/storage
#4. ls -ld /media/g*4/storage/www

And the output I received.
The output is a new format to me but correct me if I am mistaken:

1. 'usr='root' , grp='www-data'
2. 'usr'=gilray4', grp='www-data'
3. 'usr='gilray4' grp='gilray4'
4. 'usr='gilray4' grp='gilray4'

That seems kind of messy ?
Would'nt be better if the group 'www-data' persisted to 'www' dir?
Is the fact that 'storage' is gilray4 usr and group why I can't change 'www' group to www-data' ?
~~~~~~~~~~~~~~~~~~~~~

I'm going to go and try/see what happens if I change,
'storage' to be in the www-data' group instead of 'gilray4' group,
then see if I can get 'www' group modified from 'girlay4' to 'ww-data
(which I can't do right now no matter what. I get a permission denied error)

gilray4
Posts: 17
Joined: Wed Mar 20, 2019 8:33 am
languages_spoken: english
ODROIDs: XU-4
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Permissions issues moving an Apache DocRoot

Unread post by gilray4 » Sun Nov 24, 2019 8:15 am

Well I managed to:
change /var/www to group= 'www-data'
add/change /media and /gilray4 to group= 'www-data'
But the system will not let me change the group of 'storage or 'www' within it.
These users thanked the author gilray4 for the post:
odroid (Mon Nov 25, 2019 9:53 am)

gilray4
Posts: 17
Joined: Wed Mar 20, 2019 8:33 am
languages_spoken: english
ODROIDs: XU-4
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Permissions issues moving an Apache DocRoot

Unread post by gilray4 » Sun Dec 01, 2019 5:10 am

Crickets ...? :)

User avatar
mad_ady
Posts: 6858
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 235 times
Been thanked: 177 times
Contact:

Re: Permissions issues moving an Apache DocRoot

Unread post by mad_ady » Sun Dec 01, 2019 2:39 pm

Well, I'd try running apache in debug mode $ httpd -X maybe it says something useful...

Post Reply

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 1 guest