How to configure Apache to serve pages in a shared folder from host machine?












2














I'm running Ubuntu 18.10 over Windows 10 using Virtualbox 5.2.22



Let me explain what I'm trying to achieve. In Windows, I have two developing environments. I'm developing using a WAMP server. I use Dropbox to sync my two development environments. Here's how: I have a directory d:Dropbox_www then I have both of my Apaches configured exactly the same way. In development, I use SQLite, so I have no problems with the database. I've been working this way over a year with no problems.



My only problem is that I use my home computer as one of the environments, and it has been filled up with games, other programs and such, so I thought it could be a good idea to replicate my environment over a clean VM using Linux.



I made d:dropbox_www a shared folder, and it mounts on /media/sf__www I have full access to it, I can use VS Code to edit files and such.



Now I configured the LAMP server, Apache 2, PHP and mySQL are working perfectly, I did a small page at /var/www/test and everything is Okay



My problem is I can't configure Apache's virtual server to point to /media/sf__www. This is what I did:



In /etc/hosts I added:



laravel.com.devel    127.0.0.1


I created a laravel.conf in /etc/apache2/sites-available with the following:



<VirtualHost *:80>
ServerAdmin whatever@gmail.com
DocumentRoot /media/sf__www/lara/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName laravel.com.devel
</VirtualHost>


In the apache2.conf I have the following:



<Directory "/media/sf__www/lara/">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>


Then I activated the site and restarted Apache:



sudo a2ensite laravel.conf
service apache2 reload


Now, when I go to the browser all I get is a 403:



Forbidden

You don't have permission to access / on this server.
Apache/2.4.34 (Ubuntu) Server at laravel.com.devel Port 80


Thinking that it might be related to permissions in the filesystem (I'm pretty novice in Ubuntu) I did a sudo chmod 777 lara -R to change all the permissions in the directory, but still it gives me the 403.



So, any idea on how do I have to configure Apache in order to work with a directory outside /var/www/ ?



EDIT:
Partial output from ll /media/sf__www/lara is:



drwxrwx--- 1 root vboxsf   4096 oct 23 17:51 ./
drwxrwx--- 1 root vboxsf 4096 dic 8 09:58 ../
drwxrwx--- 1 root vboxsf 4096 oct 26 21:05 app/
-rwxrwx--- 1 root vboxsf 1686 oct 22 18:44 artisan*
drwxrwx--- 1 root vboxsf 0 oct 21 12:08 bootstrap/
-rwxrwx--- 1 root vboxsf 1477 oct 22 18:44 composer.json*
-rwxrwx--- 1 root vboxsf 144373 oct 22 18:48 composer.lock*


Looks like you can't chmod/chown this directory





EDIT: Output of groups



luisferfranco@luisfer-vb:/media/sf__www/lara$ groups
luisferfranco adm cdrom sudo dip plugdev lpadmin sambashare vboxsf




EDIT: Output of setfacl on the directory:



luisferfranco@luisfer-vb:/media/sf__www/lara$ sudo setfacl -d -R -m u:$USER:rwx,g:www-data:rwx,o:rx /media/sf__www/lara
[sudo] contraseña para luisferfranco:
setfacl: /media/sf__www/lara: La operación no está soportada
setfacl: /media/sf__www/lara/app: La operación no está soportada
setfacl: /media/sf__www/lara/app/Console: La operación no está soportada
setfacl: /media/sf__www/lara/app/Exceptions: La operación no está soportada


It says "operation not supported" for each file. I'm reading in other site, this might be related to the partitions





EDIT: [SOLVED]



I want to thank George Udosen (https://askubuntu.com/users/459561/george-udosen user:459561), he was in the chat for over an hour, helping me to solve this issue. He tried lots of different things until it worked. Basically what nailed the problem was adding one user to the vboxsf group as shown:



sudo adduser www-data vboxsf



Thank you very much, you took too much time from your Christmas Day to help a complete stranger, you're a great person.










share|improve this question
























  • what the output of ll /media/sf__www/lara/??
    – abu-ahmed al-khatiri
    Dec 25 '18 at 15:40










  • Just to show a few lines: drwxrwx--- 1 root vboxsf 4096 oct 23 17:51 ./ drwxrwx--- 1 root vboxsf 4096 dic 8 09:58 ../ drwxrwx--- 1 root vboxsf 4096 oct 26 21:05 app/ -rwxrwx--- 1 root vboxsf 1686 oct 22 18:44 artisan* drwxrwx--- 1 root vboxsf 0 oct 21 12:08 bootstrap/ Looks like you can't change ownership or permission flags on this directory, maybe because is mounted in /media/? I can write into it, tho.
    – luisfer
    Dec 25 '18 at 15:51












  • did you change ownership as www-data group on the directory d:dropbox_www ??
    – abu-ahmed al-khatiri
    Dec 25 '18 at 16:09










  • No, I don't have a www-data group, I'm not sure it is needed, the other directory under /var/www where I did my testing is owned by root:root with permissions 755
    – luisfer
    Dec 25 '18 at 16:17










  • Pls run cat /etc/passwd | grep www-data!
    – George Udosen
    Dec 25 '18 at 16:20
















2














I'm running Ubuntu 18.10 over Windows 10 using Virtualbox 5.2.22



Let me explain what I'm trying to achieve. In Windows, I have two developing environments. I'm developing using a WAMP server. I use Dropbox to sync my two development environments. Here's how: I have a directory d:Dropbox_www then I have both of my Apaches configured exactly the same way. In development, I use SQLite, so I have no problems with the database. I've been working this way over a year with no problems.



My only problem is that I use my home computer as one of the environments, and it has been filled up with games, other programs and such, so I thought it could be a good idea to replicate my environment over a clean VM using Linux.



I made d:dropbox_www a shared folder, and it mounts on /media/sf__www I have full access to it, I can use VS Code to edit files and such.



Now I configured the LAMP server, Apache 2, PHP and mySQL are working perfectly, I did a small page at /var/www/test and everything is Okay



My problem is I can't configure Apache's virtual server to point to /media/sf__www. This is what I did:



In /etc/hosts I added:



laravel.com.devel    127.0.0.1


I created a laravel.conf in /etc/apache2/sites-available with the following:



<VirtualHost *:80>
ServerAdmin whatever@gmail.com
DocumentRoot /media/sf__www/lara/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName laravel.com.devel
</VirtualHost>


In the apache2.conf I have the following:



<Directory "/media/sf__www/lara/">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>


Then I activated the site and restarted Apache:



sudo a2ensite laravel.conf
service apache2 reload


Now, when I go to the browser all I get is a 403:



Forbidden

You don't have permission to access / on this server.
Apache/2.4.34 (Ubuntu) Server at laravel.com.devel Port 80


Thinking that it might be related to permissions in the filesystem (I'm pretty novice in Ubuntu) I did a sudo chmod 777 lara -R to change all the permissions in the directory, but still it gives me the 403.



So, any idea on how do I have to configure Apache in order to work with a directory outside /var/www/ ?



EDIT:
Partial output from ll /media/sf__www/lara is:



drwxrwx--- 1 root vboxsf   4096 oct 23 17:51 ./
drwxrwx--- 1 root vboxsf 4096 dic 8 09:58 ../
drwxrwx--- 1 root vboxsf 4096 oct 26 21:05 app/
-rwxrwx--- 1 root vboxsf 1686 oct 22 18:44 artisan*
drwxrwx--- 1 root vboxsf 0 oct 21 12:08 bootstrap/
-rwxrwx--- 1 root vboxsf 1477 oct 22 18:44 composer.json*
-rwxrwx--- 1 root vboxsf 144373 oct 22 18:48 composer.lock*


Looks like you can't chmod/chown this directory





EDIT: Output of groups



luisferfranco@luisfer-vb:/media/sf__www/lara$ groups
luisferfranco adm cdrom sudo dip plugdev lpadmin sambashare vboxsf




EDIT: Output of setfacl on the directory:



luisferfranco@luisfer-vb:/media/sf__www/lara$ sudo setfacl -d -R -m u:$USER:rwx,g:www-data:rwx,o:rx /media/sf__www/lara
[sudo] contraseña para luisferfranco:
setfacl: /media/sf__www/lara: La operación no está soportada
setfacl: /media/sf__www/lara/app: La operación no está soportada
setfacl: /media/sf__www/lara/app/Console: La operación no está soportada
setfacl: /media/sf__www/lara/app/Exceptions: La operación no está soportada


It says "operation not supported" for each file. I'm reading in other site, this might be related to the partitions





EDIT: [SOLVED]



I want to thank George Udosen (https://askubuntu.com/users/459561/george-udosen user:459561), he was in the chat for over an hour, helping me to solve this issue. He tried lots of different things until it worked. Basically what nailed the problem was adding one user to the vboxsf group as shown:



sudo adduser www-data vboxsf



Thank you very much, you took too much time from your Christmas Day to help a complete stranger, you're a great person.










share|improve this question
























  • what the output of ll /media/sf__www/lara/??
    – abu-ahmed al-khatiri
    Dec 25 '18 at 15:40










  • Just to show a few lines: drwxrwx--- 1 root vboxsf 4096 oct 23 17:51 ./ drwxrwx--- 1 root vboxsf 4096 dic 8 09:58 ../ drwxrwx--- 1 root vboxsf 4096 oct 26 21:05 app/ -rwxrwx--- 1 root vboxsf 1686 oct 22 18:44 artisan* drwxrwx--- 1 root vboxsf 0 oct 21 12:08 bootstrap/ Looks like you can't change ownership or permission flags on this directory, maybe because is mounted in /media/? I can write into it, tho.
    – luisfer
    Dec 25 '18 at 15:51












  • did you change ownership as www-data group on the directory d:dropbox_www ??
    – abu-ahmed al-khatiri
    Dec 25 '18 at 16:09










  • No, I don't have a www-data group, I'm not sure it is needed, the other directory under /var/www where I did my testing is owned by root:root with permissions 755
    – luisfer
    Dec 25 '18 at 16:17










  • Pls run cat /etc/passwd | grep www-data!
    – George Udosen
    Dec 25 '18 at 16:20














2












2








2







I'm running Ubuntu 18.10 over Windows 10 using Virtualbox 5.2.22



Let me explain what I'm trying to achieve. In Windows, I have two developing environments. I'm developing using a WAMP server. I use Dropbox to sync my two development environments. Here's how: I have a directory d:Dropbox_www then I have both of my Apaches configured exactly the same way. In development, I use SQLite, so I have no problems with the database. I've been working this way over a year with no problems.



My only problem is that I use my home computer as one of the environments, and it has been filled up with games, other programs and such, so I thought it could be a good idea to replicate my environment over a clean VM using Linux.



I made d:dropbox_www a shared folder, and it mounts on /media/sf__www I have full access to it, I can use VS Code to edit files and such.



Now I configured the LAMP server, Apache 2, PHP and mySQL are working perfectly, I did a small page at /var/www/test and everything is Okay



My problem is I can't configure Apache's virtual server to point to /media/sf__www. This is what I did:



In /etc/hosts I added:



laravel.com.devel    127.0.0.1


I created a laravel.conf in /etc/apache2/sites-available with the following:



<VirtualHost *:80>
ServerAdmin whatever@gmail.com
DocumentRoot /media/sf__www/lara/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName laravel.com.devel
</VirtualHost>


In the apache2.conf I have the following:



<Directory "/media/sf__www/lara/">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>


Then I activated the site and restarted Apache:



sudo a2ensite laravel.conf
service apache2 reload


Now, when I go to the browser all I get is a 403:



Forbidden

You don't have permission to access / on this server.
Apache/2.4.34 (Ubuntu) Server at laravel.com.devel Port 80


Thinking that it might be related to permissions in the filesystem (I'm pretty novice in Ubuntu) I did a sudo chmod 777 lara -R to change all the permissions in the directory, but still it gives me the 403.



So, any idea on how do I have to configure Apache in order to work with a directory outside /var/www/ ?



EDIT:
Partial output from ll /media/sf__www/lara is:



drwxrwx--- 1 root vboxsf   4096 oct 23 17:51 ./
drwxrwx--- 1 root vboxsf 4096 dic 8 09:58 ../
drwxrwx--- 1 root vboxsf 4096 oct 26 21:05 app/
-rwxrwx--- 1 root vboxsf 1686 oct 22 18:44 artisan*
drwxrwx--- 1 root vboxsf 0 oct 21 12:08 bootstrap/
-rwxrwx--- 1 root vboxsf 1477 oct 22 18:44 composer.json*
-rwxrwx--- 1 root vboxsf 144373 oct 22 18:48 composer.lock*


Looks like you can't chmod/chown this directory





EDIT: Output of groups



luisferfranco@luisfer-vb:/media/sf__www/lara$ groups
luisferfranco adm cdrom sudo dip plugdev lpadmin sambashare vboxsf




EDIT: Output of setfacl on the directory:



luisferfranco@luisfer-vb:/media/sf__www/lara$ sudo setfacl -d -R -m u:$USER:rwx,g:www-data:rwx,o:rx /media/sf__www/lara
[sudo] contraseña para luisferfranco:
setfacl: /media/sf__www/lara: La operación no está soportada
setfacl: /media/sf__www/lara/app: La operación no está soportada
setfacl: /media/sf__www/lara/app/Console: La operación no está soportada
setfacl: /media/sf__www/lara/app/Exceptions: La operación no está soportada


It says "operation not supported" for each file. I'm reading in other site, this might be related to the partitions





EDIT: [SOLVED]



I want to thank George Udosen (https://askubuntu.com/users/459561/george-udosen user:459561), he was in the chat for over an hour, helping me to solve this issue. He tried lots of different things until it worked. Basically what nailed the problem was adding one user to the vboxsf group as shown:



sudo adduser www-data vboxsf



Thank you very much, you took too much time from your Christmas Day to help a complete stranger, you're a great person.










share|improve this question















I'm running Ubuntu 18.10 over Windows 10 using Virtualbox 5.2.22



Let me explain what I'm trying to achieve. In Windows, I have two developing environments. I'm developing using a WAMP server. I use Dropbox to sync my two development environments. Here's how: I have a directory d:Dropbox_www then I have both of my Apaches configured exactly the same way. In development, I use SQLite, so I have no problems with the database. I've been working this way over a year with no problems.



My only problem is that I use my home computer as one of the environments, and it has been filled up with games, other programs and such, so I thought it could be a good idea to replicate my environment over a clean VM using Linux.



I made d:dropbox_www a shared folder, and it mounts on /media/sf__www I have full access to it, I can use VS Code to edit files and such.



Now I configured the LAMP server, Apache 2, PHP and mySQL are working perfectly, I did a small page at /var/www/test and everything is Okay



My problem is I can't configure Apache's virtual server to point to /media/sf__www. This is what I did:



In /etc/hosts I added:



laravel.com.devel    127.0.0.1


I created a laravel.conf in /etc/apache2/sites-available with the following:



<VirtualHost *:80>
ServerAdmin whatever@gmail.com
DocumentRoot /media/sf__www/lara/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName laravel.com.devel
</VirtualHost>


In the apache2.conf I have the following:



<Directory "/media/sf__www/lara/">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>


Then I activated the site and restarted Apache:



sudo a2ensite laravel.conf
service apache2 reload


Now, when I go to the browser all I get is a 403:



Forbidden

You don't have permission to access / on this server.
Apache/2.4.34 (Ubuntu) Server at laravel.com.devel Port 80


Thinking that it might be related to permissions in the filesystem (I'm pretty novice in Ubuntu) I did a sudo chmod 777 lara -R to change all the permissions in the directory, but still it gives me the 403.



So, any idea on how do I have to configure Apache in order to work with a directory outside /var/www/ ?



EDIT:
Partial output from ll /media/sf__www/lara is:



drwxrwx--- 1 root vboxsf   4096 oct 23 17:51 ./
drwxrwx--- 1 root vboxsf 4096 dic 8 09:58 ../
drwxrwx--- 1 root vboxsf 4096 oct 26 21:05 app/
-rwxrwx--- 1 root vboxsf 1686 oct 22 18:44 artisan*
drwxrwx--- 1 root vboxsf 0 oct 21 12:08 bootstrap/
-rwxrwx--- 1 root vboxsf 1477 oct 22 18:44 composer.json*
-rwxrwx--- 1 root vboxsf 144373 oct 22 18:48 composer.lock*


Looks like you can't chmod/chown this directory





EDIT: Output of groups



luisferfranco@luisfer-vb:/media/sf__www/lara$ groups
luisferfranco adm cdrom sudo dip plugdev lpadmin sambashare vboxsf




EDIT: Output of setfacl on the directory:



luisferfranco@luisfer-vb:/media/sf__www/lara$ sudo setfacl -d -R -m u:$USER:rwx,g:www-data:rwx,o:rx /media/sf__www/lara
[sudo] contraseña para luisferfranco:
setfacl: /media/sf__www/lara: La operación no está soportada
setfacl: /media/sf__www/lara/app: La operación no está soportada
setfacl: /media/sf__www/lara/app/Console: La operación no está soportada
setfacl: /media/sf__www/lara/app/Exceptions: La operación no está soportada


It says "operation not supported" for each file. I'm reading in other site, this might be related to the partitions





EDIT: [SOLVED]



I want to thank George Udosen (https://askubuntu.com/users/459561/george-udosen user:459561), he was in the chat for over an hour, helping me to solve this issue. He tried lots of different things until it worked. Basically what nailed the problem was adding one user to the vboxsf group as shown:



sudo adduser www-data vboxsf



Thank you very much, you took too much time from your Christmas Day to help a complete stranger, you're a great person.







server permissions apache2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 26 '18 at 4:05







luisfer

















asked Dec 25 '18 at 15:18









luisferluisfer

1206




1206












  • what the output of ll /media/sf__www/lara/??
    – abu-ahmed al-khatiri
    Dec 25 '18 at 15:40










  • Just to show a few lines: drwxrwx--- 1 root vboxsf 4096 oct 23 17:51 ./ drwxrwx--- 1 root vboxsf 4096 dic 8 09:58 ../ drwxrwx--- 1 root vboxsf 4096 oct 26 21:05 app/ -rwxrwx--- 1 root vboxsf 1686 oct 22 18:44 artisan* drwxrwx--- 1 root vboxsf 0 oct 21 12:08 bootstrap/ Looks like you can't change ownership or permission flags on this directory, maybe because is mounted in /media/? I can write into it, tho.
    – luisfer
    Dec 25 '18 at 15:51












  • did you change ownership as www-data group on the directory d:dropbox_www ??
    – abu-ahmed al-khatiri
    Dec 25 '18 at 16:09










  • No, I don't have a www-data group, I'm not sure it is needed, the other directory under /var/www where I did my testing is owned by root:root with permissions 755
    – luisfer
    Dec 25 '18 at 16:17










  • Pls run cat /etc/passwd | grep www-data!
    – George Udosen
    Dec 25 '18 at 16:20


















  • what the output of ll /media/sf__www/lara/??
    – abu-ahmed al-khatiri
    Dec 25 '18 at 15:40










  • Just to show a few lines: drwxrwx--- 1 root vboxsf 4096 oct 23 17:51 ./ drwxrwx--- 1 root vboxsf 4096 dic 8 09:58 ../ drwxrwx--- 1 root vboxsf 4096 oct 26 21:05 app/ -rwxrwx--- 1 root vboxsf 1686 oct 22 18:44 artisan* drwxrwx--- 1 root vboxsf 0 oct 21 12:08 bootstrap/ Looks like you can't change ownership or permission flags on this directory, maybe because is mounted in /media/? I can write into it, tho.
    – luisfer
    Dec 25 '18 at 15:51












  • did you change ownership as www-data group on the directory d:dropbox_www ??
    – abu-ahmed al-khatiri
    Dec 25 '18 at 16:09










  • No, I don't have a www-data group, I'm not sure it is needed, the other directory under /var/www where I did my testing is owned by root:root with permissions 755
    – luisfer
    Dec 25 '18 at 16:17










  • Pls run cat /etc/passwd | grep www-data!
    – George Udosen
    Dec 25 '18 at 16:20
















what the output of ll /media/sf__www/lara/??
– abu-ahmed al-khatiri
Dec 25 '18 at 15:40




what the output of ll /media/sf__www/lara/??
– abu-ahmed al-khatiri
Dec 25 '18 at 15:40












Just to show a few lines: drwxrwx--- 1 root vboxsf 4096 oct 23 17:51 ./ drwxrwx--- 1 root vboxsf 4096 dic 8 09:58 ../ drwxrwx--- 1 root vboxsf 4096 oct 26 21:05 app/ -rwxrwx--- 1 root vboxsf 1686 oct 22 18:44 artisan* drwxrwx--- 1 root vboxsf 0 oct 21 12:08 bootstrap/ Looks like you can't change ownership or permission flags on this directory, maybe because is mounted in /media/? I can write into it, tho.
– luisfer
Dec 25 '18 at 15:51






Just to show a few lines: drwxrwx--- 1 root vboxsf 4096 oct 23 17:51 ./ drwxrwx--- 1 root vboxsf 4096 dic 8 09:58 ../ drwxrwx--- 1 root vboxsf 4096 oct 26 21:05 app/ -rwxrwx--- 1 root vboxsf 1686 oct 22 18:44 artisan* drwxrwx--- 1 root vboxsf 0 oct 21 12:08 bootstrap/ Looks like you can't change ownership or permission flags on this directory, maybe because is mounted in /media/? I can write into it, tho.
– luisfer
Dec 25 '18 at 15:51














did you change ownership as www-data group on the directory d:dropbox_www ??
– abu-ahmed al-khatiri
Dec 25 '18 at 16:09




did you change ownership as www-data group on the directory d:dropbox_www ??
– abu-ahmed al-khatiri
Dec 25 '18 at 16:09












No, I don't have a www-data group, I'm not sure it is needed, the other directory under /var/www where I did my testing is owned by root:root with permissions 755
– luisfer
Dec 25 '18 at 16:17




No, I don't have a www-data group, I'm not sure it is needed, the other directory under /var/www where I did my testing is owned by root:root with permissions 755
– luisfer
Dec 25 '18 at 16:17












Pls run cat /etc/passwd | grep www-data!
– George Udosen
Dec 25 '18 at 16:20




Pls run cat /etc/passwd | grep www-data!
– George Udosen
Dec 25 '18 at 16:20










2 Answers
2






active

oldest

votes


















1














Trying to have apache access shared folder from a Windows host on an Ubuntu guest is tricky as Virtualbox mounts the shared folder with the user root and group vboxsf. To get this to work after we (OP and I) tried to remount that location with the command



 sudo mount -t vboxsf -o remount,uid=1000,gid=1000,rw __www /media/sf__www


This didn't work so a workaround was used where we added the apache user www-data to the group vboxsf with the command



 sudo adduser www-data vboxsf


and with after that apache on the guest was able to access that location.






share|improve this answer























  • I can't. For some reason above my understanding you can't chown/chmod the /media/sf__www directory. Maybe it is because is a shared folder coming from the host machine, being a strange restriction by VirtualBox?
    – luisfer
    Dec 25 '18 at 16:03










  • I ran the setfacl command and I'm getting an "operation not supported" (I'm translating from spanish)
    – luisfer
    Dec 25 '18 at 16:05










  • please run groups in the VM and let me see the output!
    – George Udosen
    Dec 25 '18 at 16:09










  • Done, just edited the question
    – luisfer
    Dec 25 '18 at 16:11










  • You are running it on /media/sf_www it should be on /media/sf_www/lara!!!
    – George Udosen
    Dec 25 '18 at 16:15



















0














Myself is a newbie, but I can give you a little hint to resolve this case, we usually have the directory structure which are owned by root user (default). If we want our regular user to be able to modify files in our web directories, you can change the ownership by doing this:



sudo chown -R $USER:$USER /media/sf__www/lara/


Please ensure that this Lara directory is owned by the general user if not, try the above command then restart Apache, it might work for you then later you can change the mode of the directory to 755 as usual.
Let me know if it resolves your issue.






share|improve this answer





















  • Didn't work, looks like you can't change ownership or permissions in the /media/sf_www directory or its child
    – luisfer
    Dec 25 '18 at 15:49










  • what is the result of -> ls -al /media/sf__www/lara/ ? do you get any error when you try changing the ownership and the permissions of the directory when being root ?
    – Imrank
    Dec 25 '18 at 16:02










  • When I ran setfacl as recommended above, I got an "operation not supported" message. The chmod/chown says nothing
    – luisfer
    Dec 25 '18 at 16:13










  • If I do a -v on chmod, it says it changed the owner, but it actually does nothing
    – luisfer
    Dec 25 '18 at 16:14











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1104456%2fhow-to-configure-apache-to-serve-pages-in-a-shared-folder-from-host-machine%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Trying to have apache access shared folder from a Windows host on an Ubuntu guest is tricky as Virtualbox mounts the shared folder with the user root and group vboxsf. To get this to work after we (OP and I) tried to remount that location with the command



 sudo mount -t vboxsf -o remount,uid=1000,gid=1000,rw __www /media/sf__www


This didn't work so a workaround was used where we added the apache user www-data to the group vboxsf with the command



 sudo adduser www-data vboxsf


and with after that apache on the guest was able to access that location.






share|improve this answer























  • I can't. For some reason above my understanding you can't chown/chmod the /media/sf__www directory. Maybe it is because is a shared folder coming from the host machine, being a strange restriction by VirtualBox?
    – luisfer
    Dec 25 '18 at 16:03










  • I ran the setfacl command and I'm getting an "operation not supported" (I'm translating from spanish)
    – luisfer
    Dec 25 '18 at 16:05










  • please run groups in the VM and let me see the output!
    – George Udosen
    Dec 25 '18 at 16:09










  • Done, just edited the question
    – luisfer
    Dec 25 '18 at 16:11










  • You are running it on /media/sf_www it should be on /media/sf_www/lara!!!
    – George Udosen
    Dec 25 '18 at 16:15
















1














Trying to have apache access shared folder from a Windows host on an Ubuntu guest is tricky as Virtualbox mounts the shared folder with the user root and group vboxsf. To get this to work after we (OP and I) tried to remount that location with the command



 sudo mount -t vboxsf -o remount,uid=1000,gid=1000,rw __www /media/sf__www


This didn't work so a workaround was used where we added the apache user www-data to the group vboxsf with the command



 sudo adduser www-data vboxsf


and with after that apache on the guest was able to access that location.






share|improve this answer























  • I can't. For some reason above my understanding you can't chown/chmod the /media/sf__www directory. Maybe it is because is a shared folder coming from the host machine, being a strange restriction by VirtualBox?
    – luisfer
    Dec 25 '18 at 16:03










  • I ran the setfacl command and I'm getting an "operation not supported" (I'm translating from spanish)
    – luisfer
    Dec 25 '18 at 16:05










  • please run groups in the VM and let me see the output!
    – George Udosen
    Dec 25 '18 at 16:09










  • Done, just edited the question
    – luisfer
    Dec 25 '18 at 16:11










  • You are running it on /media/sf_www it should be on /media/sf_www/lara!!!
    – George Udosen
    Dec 25 '18 at 16:15














1












1








1






Trying to have apache access shared folder from a Windows host on an Ubuntu guest is tricky as Virtualbox mounts the shared folder with the user root and group vboxsf. To get this to work after we (OP and I) tried to remount that location with the command



 sudo mount -t vboxsf -o remount,uid=1000,gid=1000,rw __www /media/sf__www


This didn't work so a workaround was used where we added the apache user www-data to the group vboxsf with the command



 sudo adduser www-data vboxsf


and with after that apache on the guest was able to access that location.






share|improve this answer














Trying to have apache access shared folder from a Windows host on an Ubuntu guest is tricky as Virtualbox mounts the shared folder with the user root and group vboxsf. To get this to work after we (OP and I) tried to remount that location with the command



 sudo mount -t vboxsf -o remount,uid=1000,gid=1000,rw __www /media/sf__www


This didn't work so a workaround was used where we added the apache user www-data to the group vboxsf with the command



 sudo adduser www-data vboxsf


and with after that apache on the guest was able to access that location.







share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 25 '18 at 17:32

























answered Dec 25 '18 at 15:53









George UdosenGeorge Udosen

20.2k94367




20.2k94367












  • I can't. For some reason above my understanding you can't chown/chmod the /media/sf__www directory. Maybe it is because is a shared folder coming from the host machine, being a strange restriction by VirtualBox?
    – luisfer
    Dec 25 '18 at 16:03










  • I ran the setfacl command and I'm getting an "operation not supported" (I'm translating from spanish)
    – luisfer
    Dec 25 '18 at 16:05










  • please run groups in the VM and let me see the output!
    – George Udosen
    Dec 25 '18 at 16:09










  • Done, just edited the question
    – luisfer
    Dec 25 '18 at 16:11










  • You are running it on /media/sf_www it should be on /media/sf_www/lara!!!
    – George Udosen
    Dec 25 '18 at 16:15


















  • I can't. For some reason above my understanding you can't chown/chmod the /media/sf__www directory. Maybe it is because is a shared folder coming from the host machine, being a strange restriction by VirtualBox?
    – luisfer
    Dec 25 '18 at 16:03










  • I ran the setfacl command and I'm getting an "operation not supported" (I'm translating from spanish)
    – luisfer
    Dec 25 '18 at 16:05










  • please run groups in the VM and let me see the output!
    – George Udosen
    Dec 25 '18 at 16:09










  • Done, just edited the question
    – luisfer
    Dec 25 '18 at 16:11










  • You are running it on /media/sf_www it should be on /media/sf_www/lara!!!
    – George Udosen
    Dec 25 '18 at 16:15
















I can't. For some reason above my understanding you can't chown/chmod the /media/sf__www directory. Maybe it is because is a shared folder coming from the host machine, being a strange restriction by VirtualBox?
– luisfer
Dec 25 '18 at 16:03




I can't. For some reason above my understanding you can't chown/chmod the /media/sf__www directory. Maybe it is because is a shared folder coming from the host machine, being a strange restriction by VirtualBox?
– luisfer
Dec 25 '18 at 16:03












I ran the setfacl command and I'm getting an "operation not supported" (I'm translating from spanish)
– luisfer
Dec 25 '18 at 16:05




I ran the setfacl command and I'm getting an "operation not supported" (I'm translating from spanish)
– luisfer
Dec 25 '18 at 16:05












please run groups in the VM and let me see the output!
– George Udosen
Dec 25 '18 at 16:09




please run groups in the VM and let me see the output!
– George Udosen
Dec 25 '18 at 16:09












Done, just edited the question
– luisfer
Dec 25 '18 at 16:11




Done, just edited the question
– luisfer
Dec 25 '18 at 16:11












You are running it on /media/sf_www it should be on /media/sf_www/lara!!!
– George Udosen
Dec 25 '18 at 16:15




You are running it on /media/sf_www it should be on /media/sf_www/lara!!!
– George Udosen
Dec 25 '18 at 16:15













0














Myself is a newbie, but I can give you a little hint to resolve this case, we usually have the directory structure which are owned by root user (default). If we want our regular user to be able to modify files in our web directories, you can change the ownership by doing this:



sudo chown -R $USER:$USER /media/sf__www/lara/


Please ensure that this Lara directory is owned by the general user if not, try the above command then restart Apache, it might work for you then later you can change the mode of the directory to 755 as usual.
Let me know if it resolves your issue.






share|improve this answer





















  • Didn't work, looks like you can't change ownership or permissions in the /media/sf_www directory or its child
    – luisfer
    Dec 25 '18 at 15:49










  • what is the result of -> ls -al /media/sf__www/lara/ ? do you get any error when you try changing the ownership and the permissions of the directory when being root ?
    – Imrank
    Dec 25 '18 at 16:02










  • When I ran setfacl as recommended above, I got an "operation not supported" message. The chmod/chown says nothing
    – luisfer
    Dec 25 '18 at 16:13










  • If I do a -v on chmod, it says it changed the owner, but it actually does nothing
    – luisfer
    Dec 25 '18 at 16:14
















0














Myself is a newbie, but I can give you a little hint to resolve this case, we usually have the directory structure which are owned by root user (default). If we want our regular user to be able to modify files in our web directories, you can change the ownership by doing this:



sudo chown -R $USER:$USER /media/sf__www/lara/


Please ensure that this Lara directory is owned by the general user if not, try the above command then restart Apache, it might work for you then later you can change the mode of the directory to 755 as usual.
Let me know if it resolves your issue.






share|improve this answer





















  • Didn't work, looks like you can't change ownership or permissions in the /media/sf_www directory or its child
    – luisfer
    Dec 25 '18 at 15:49










  • what is the result of -> ls -al /media/sf__www/lara/ ? do you get any error when you try changing the ownership and the permissions of the directory when being root ?
    – Imrank
    Dec 25 '18 at 16:02










  • When I ran setfacl as recommended above, I got an "operation not supported" message. The chmod/chown says nothing
    – luisfer
    Dec 25 '18 at 16:13










  • If I do a -v on chmod, it says it changed the owner, but it actually does nothing
    – luisfer
    Dec 25 '18 at 16:14














0












0








0






Myself is a newbie, but I can give you a little hint to resolve this case, we usually have the directory structure which are owned by root user (default). If we want our regular user to be able to modify files in our web directories, you can change the ownership by doing this:



sudo chown -R $USER:$USER /media/sf__www/lara/


Please ensure that this Lara directory is owned by the general user if not, try the above command then restart Apache, it might work for you then later you can change the mode of the directory to 755 as usual.
Let me know if it resolves your issue.






share|improve this answer












Myself is a newbie, but I can give you a little hint to resolve this case, we usually have the directory structure which are owned by root user (default). If we want our regular user to be able to modify files in our web directories, you can change the ownership by doing this:



sudo chown -R $USER:$USER /media/sf__www/lara/


Please ensure that this Lara directory is owned by the general user if not, try the above command then restart Apache, it might work for you then later you can change the mode of the directory to 755 as usual.
Let me know if it resolves your issue.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 25 '18 at 15:35









ImrankImrank

268




268












  • Didn't work, looks like you can't change ownership or permissions in the /media/sf_www directory or its child
    – luisfer
    Dec 25 '18 at 15:49










  • what is the result of -> ls -al /media/sf__www/lara/ ? do you get any error when you try changing the ownership and the permissions of the directory when being root ?
    – Imrank
    Dec 25 '18 at 16:02










  • When I ran setfacl as recommended above, I got an "operation not supported" message. The chmod/chown says nothing
    – luisfer
    Dec 25 '18 at 16:13










  • If I do a -v on chmod, it says it changed the owner, but it actually does nothing
    – luisfer
    Dec 25 '18 at 16:14


















  • Didn't work, looks like you can't change ownership or permissions in the /media/sf_www directory or its child
    – luisfer
    Dec 25 '18 at 15:49










  • what is the result of -> ls -al /media/sf__www/lara/ ? do you get any error when you try changing the ownership and the permissions of the directory when being root ?
    – Imrank
    Dec 25 '18 at 16:02










  • When I ran setfacl as recommended above, I got an "operation not supported" message. The chmod/chown says nothing
    – luisfer
    Dec 25 '18 at 16:13










  • If I do a -v on chmod, it says it changed the owner, but it actually does nothing
    – luisfer
    Dec 25 '18 at 16:14
















Didn't work, looks like you can't change ownership or permissions in the /media/sf_www directory or its child
– luisfer
Dec 25 '18 at 15:49




Didn't work, looks like you can't change ownership or permissions in the /media/sf_www directory or its child
– luisfer
Dec 25 '18 at 15:49












what is the result of -> ls -al /media/sf__www/lara/ ? do you get any error when you try changing the ownership and the permissions of the directory when being root ?
– Imrank
Dec 25 '18 at 16:02




what is the result of -> ls -al /media/sf__www/lara/ ? do you get any error when you try changing the ownership and the permissions of the directory when being root ?
– Imrank
Dec 25 '18 at 16:02












When I ran setfacl as recommended above, I got an "operation not supported" message. The chmod/chown says nothing
– luisfer
Dec 25 '18 at 16:13




When I ran setfacl as recommended above, I got an "operation not supported" message. The chmod/chown says nothing
– luisfer
Dec 25 '18 at 16:13












If I do a -v on chmod, it says it changed the owner, but it actually does nothing
– luisfer
Dec 25 '18 at 16:14




If I do a -v on chmod, it says it changed the owner, but it actually does nothing
– luisfer
Dec 25 '18 at 16:14


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1104456%2fhow-to-configure-apache-to-serve-pages-in-a-shared-folder-from-host-machine%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕