Can files be copied from an Ubuntu VM to a Windows host without SSH?

I ask this since coping files via SSH requires me to install an SSH server on Windows (either on Windows itself or on WSL) and I would rather pass on that as I don't have any other reason to do so.

This should use me to backup my files.

What I do now to backup files to WSL:

sudo mysqldump -u root --password --all-databases > /var/www/html/db.sql
sudo zip -r /var/www/html/dr.zip /var/www/html
sudo scp /var/www/html/db.sql /var/www/html/dr.zip USER@IP:/mnt/c/Users/USER/Desktop/
sudo rm /var/www/html/db.sql /var/www/html/dr.zip

As you can see I use the above code block to copy files from my Ubuntu to Windows via SSH.

I aspire to run a similar command set in Ubuntu to copy my files to the host machine (Windows) but this time without SSH and with some local way.

  • 1
    Yes, with samba for example, if it´s a server then you don't even need the vboxlinuxadditions. Is this an option for you or you want something else – lewis4u Apr 17 '17 at 10:59
  • That is the fastest way....you just need to sudo apt install samba and share the folder. – lewis4u Apr 17 '17 at 11:04
  • Is it good for GUI as well? – JohnDoea Apr 17 '17 at 11:05
  • If you share the folder you can access it on your network with any machine...and you can set it with password or without it. How do you mean 'good for GUI'... That virtualbox will be visible on the network and when you open it there will be your shared folder like from any other windows machine. The only question is do you want that or something else? – lewis4u Apr 17 '17 at 11:06
  • You don't need an SSH server to copy files to, or from a ubuntu VM. All you need is a suitable SFTP client – Journeyman Geek Apr 17 '17 at 11:12

The easiest way to do it is to install the samba and share a folder from your server.

  1. Install samba

    sudo apt install samba
  2. Add your linux user to samba:

    sudo smbpasswd -a <username>
    // then it will ask you to write the password
    // for that user and to confirm it
  3. In this file /etc/samba/smb.conf just write to the bottom at the end:

    comment = some_comment
    path = /path/to/your/folder
    browsable = yes
    valid users = your_username
    read only = no

After this you can see that folder on the network and access it like every other shared folder.

p.s. i think you must restart the samba service or just reboot the VM!

  • Oh and Lewis, can you please give a few more words about securing this dir? I would assume that giving it the same password of the sudoer would be enough and that no further actions are needed (I thought about the issue of brute forcing its password but it doesn't seem likely to me that it can be done without the hacker hacking either of the 2 systems first). – JohnDoea Apr 18 '17 at 3:54
  • 1
    Well I think you are pretty safe with if you set a different password for samba and make it a long one (more than 20 char long) and brute force will take very long to crack it. With technology of today 50years+ – lewis4u Apr 18 '17 at 8:57

Dropbox/virtualbox should do it. You can mount your Dropbox through your VM. Unless I am misunderstanding what you need.

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.