1

please, can someone give here step by step solution to solve this request?

I have home computer with Elementary OS and Virtual Box installed. I have a flash drive with virtual PC (Virtual Box) with Elementary OS. I have work computer with Windows 10 and VirtualBox installed.

What I'm using now: My primary coding computer is the virtual one. I have there LAMP and other development tools for PHP. On both (home and work) PCs I need to run virtual PC to work.

What I want: I want to be able to work on shared folder with PHP projects on my home PC directly (w/o virtualbox running). On my flash drive I have virtual PC with size ~32GB and same amount of free space. Is it possible to move www folder there? I mean, outside od virtual PC but on place, which is always available from inside on my virtual PC. And next thing (not so important), is it possible to make the same with mysql (mariadb) database and phpmyadmin?

So at home I want to be able to work directly on my desktop and at work I still should use the virtual PC.

What I already tried: I've formatted flash to two partitions - vboxdrive 40GB and www 20GB. Vbox drive contains virtual pc, www contains all projects. Both formatted to NTFS. By Shared folders it was really easy to map www drive to var/www/ inside guest on both win and linux hosts. Problem is, that it is inaccessible for apache due to ownerships and access rights. I'm not able to set www-data ownership on ntfs formatted partition. When i tried to format it as ext4, there was no issue after i added vboxsrv to www-data group. But I'm not able to map that shared folder on Win host, because ext4 is not supported in win. Also I will need on linux host somehow automatically map that flash partition to var/www after mount - for now I'm not sure how.

1

This is not a step by step answer.

I have had similar problems in the past. Since windows doesn't support ext4, your second approach is not an option. So you'll have to go with ntfs and fix permission problems.

Changing permissions and ownerships on mounted ntfs drives in linux doesn't work since ntfs doesn't support that concept. What happens is that when mounting ntfs partitions, linux assigns "virtual permissions" to all files in the drive and these can't be changed after mount. You have two options:

  • edit mounting options so that www-data has those "virtual permissions" on mount in /etc/fstab (the file that manages auto-mounting folders) to something like this :

/dev/NTFS-partition /var/www ntfs-3g uid=<www-data user id>,gid=<www-data group id>,umask=0022 0 0

OR

  • add www-data user to the group that currently has permission: after you mount the ntfs drive, like you previously did and got permission errors (i don't know how you did that), execute

sudo usermod -a -G groupname www-data

you can get the group name by doing ls -l /var/www

  • Wow, don't know, what was wrong before, but today I again formatted www drive to ntfs, then copied files and everything works. Usermod I did before, but it didn't work, maybe restart was required. So now I have separated projects data and I'm able to work with them at work (win 10 -> virtualized Elementary). At home I'll try to make second shared folder to the same mount location (/var/www) but with another path (/media/username/projectsDrive side by side with E:/). I hope, that VirtualBox will have no issue with that and it always mount the first available path to /var/www. – Petr Kateřiňák Jul 10 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.