Synchronize the folders between windows and Ubuntu in virtualbox

Source: Internet
Author: User
ArticleDirectory
    • 1, why do this
    • 2, preparations
    • 3, well done
1, why do this

Recently, I keep working in my guest operating system which is Ubuntu 12.4 lts. I got some project documents from my co-workers. it's better to read the arguments from Ubuntu directly, instead of switch between guest operating system (UBUNTU) and host operating system (Windows 7 ).

A simple idea came out: I want a way to sync a folder between Ubuntu and windows.RsyncMaybe a handy tools intended for sync files and folder into SS different machines.

2, preparations

1. Install the rsync

I am cygwin fan, there is package built with the cygwin, we just use it. We can get and install the package by cygwin's setup.exe.

2. Install the SSH daemon in Ubuntu (guest operating system)

$ Sudo apt-Get Install SSH

$ SS-L # Check SSH daemon is running

3, enable the virtualbox port forwarding

Adding the port forwarding for SSH, as such:

 

4. Create the sync folder

We also need create the sync folder both in Windows 7 and ubunt, in which our file keep sync.

$ Mkdir-P/cygdrive/C/virtualbox/rsync/data/# cyginw on Windows 7

$ Mkdir-P/home/Jerry/rsync/data/# Ubuntu

3, well done

It's time to show off. I put some files in the folder of "/cygdrive/C/virtualbox/rsync/data /". I want the guest operating system, Ubuntu, can also sync all of this file. just type:

Export rsync.exe-avzp -- RSH = 'ssh-P 2222 '/cygdrive/C/virtualbox/rsync/data/Jerry @ localhost:/home/Jerry/rsync/data/

When system prompt you typing the Jerry's password, just type it and enter.

All things done! Now you can view/edit the file in Ubuntu. wow? You edited file and you want to sync this to windows? No problem. Open the cygwin on Windows, type:

Export rsync.exe-avzp -- RSH = 'ssh-P 2222 'Jerry @ localhost:/home/Jerry/rsync/Data // cygdrive/C/virtualbox/rsync/data/

Even more, you may want a small shell scripting to make it automatically. Like this:

Have fun!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.