A friend has set up a vagrant vm running Ubuntu with many directories and files in it. The VM is running locally on my computer using Virtual Box. I don't want to setup a shared folder in it but I would like to browse and edit the files graphically using Filezilla. Only trouble is, I can't get it to connect. How do I do this?
3 Answers
On my machine (windows) the default is for Vagrant's sftp to be available on port 2222. So, from Filezilla, I use:
- host: 127.0.0.1
- port: 2222
- protocol: sftp
- logon type: normal (with the default user and password being "vagrant")
-
1an extra point might be "Setup Bridged network in VirtualBox so that you can ping and access the VM from your host machine" but it's an old question so the user might have already solved it or moved on but still good to document and close it– SeanCltCommented Mar 24, 2016 at 23:21
-
@Darius When I try this method I get the following error:
Disconnected: No supported authentication methods available (server sent: publickey)
. Commented Aug 15, 2019 at 4:08
By default as already described by Darius in his answer you can connect to a vagrant VM using the IP 127.0.0.1 (which is your localhost) and the port 2222, with the username vagrant and password vagrant, using any ssh or sftp client.
If you get the following error: Disconnected: No supported authentication methods available (server sent: publickey) then you can fix this problem easily. The reason for this error is that nowadays vagrant is often configured to use a public-key authentication, which is described in this article: https://www.ssh.com/ssh/public-key-authentication
But this doesn't need to be a problem, we can just use the private key stored in the vagrant configuration directory to authenticate to the virtual machine with almost any sftp client. In your sftp-client (personally using WinSCP for example) select the private key file from the following location: C:\Path\To\VagrantVM\.vagrant\machines\default\virtualbox\private_key
Make sure to replace C:\Path\To\VagrantVM\ with the actual path on your machine.
Enter the username vagrant and click connect, which should successfully open a connection to the vagrant VM.
You should use private_key for connection, connection settings :
Vagrant File : https://github.com/metedemirtas26/install-jenkins-using-vagrant-on-vm/blob/main/Vagrantfile