I want to creatre portable dev environment inside a Vagrant box. But faced a problem with ssh key access rights. On some target machines I haven't got enough rights to change them. Is it possible to configure Vagrant to have access maybe only with password to make box fully rights-independent?
-
Why not, you can try. Just change vm box path in VBox from your home folder to usb drive. – StalkAlex Apr 26 '16 at 03:01
1 Answers
You can have vagrant box running from USB (I do that a lot and its nice to take hard drive with you and go on another computer and everything is running the same)
If you run VMWare provider, this is all set as all the vagrant file and the VM files are within the .vagrant
directory from your project so just run Vagrant init
and vagrant up
within your USB and all the files are there, you can take the USB drive with you and connect to another computer running vagrant/VMWare and you're good
When you run VirtualBox provider, its a bit different as the vagrant files will be stored within your vagrant
directory but your VM files will likely be stored with your My Documents
folder.
You can overcome that by forcing VirtualBox to store the files on the USB as well - see this answer https://stackoverflow.com/a/36343325/4296747 to have multiple options how you can do that

- 1
- 1

- 51,761
- 10
- 113
- 139
-
Well, this sounds good. But how can I connect to it via ssh? I'm still getting "The private key to connect to this box via SSH has invalid permissions" after changing it's permissions to 0600. I guess this happens because key located on USB stick. If there any way to fix this? Thanks. – Nikita Unkovsky Apr 27 '16 at 13:19
-
do you use your own key or the generated one ? if you use generated one it should be under the `.vagrant` directory and set with correct permission; it you use your own indeed it must be accessible – Frederic Henri Apr 27 '16 at 13:21
-
there should be really no difference wether the vagrant files are on USB or push on hard drive directly – Frederic Henri Apr 27 '16 at 13:21
-
The 0600 permissions error comes up if the USB drive is formatted with a filesystem that doesn't support it, such as ExFAT. That's too bad, since ExFAT allows you to use the drive between Windows and Mac. – rdguam May 18 '17 at 17:49
-
I fixed the permission problem by moving the private key into mac, changing its permission to 0600, and then creating a soft link for it in the USB storage. – Spark.Bao Nov 03 '20 at 02:18
-
Finally, I found we can put all configuration files in mac, and only remain the VM in the USB storage. – Spark.Bao Nov 03 '20 at 05:10