I often use both Windows and Linux environment at work. Sometimes I need to share files between Linux & windows workstation.
There are couples of ways to share files between Linux & Windows.
- Setup Samba server (CIFS share) on your Linux box, which can be accessed from any windows machine. Because In many of the Linux distros Samba server is not installed by default. It requires installing package and setting up configuration file to share folder.
- Run Ftp server on you Linux box and use ftp client from windows box to access it. Again this solution may require starting the ftp server on the Linux machine and configuring it to allow access to shares.
- Run SSH server on Linux machine and on windows box you use secure copy(scp) or similar SSH client to do file transfer. You can download scp client for windows putty download page.This also requires installing SSH server on Linux box ( for Ubuntu by default SSH server is not installed)
Even though many of the option listed are simple , it requires some effort to setup. You need to repeat the same when you re-install Linux.
Recently I discovered simple and elegant way to achive the same using python built in SimpleHTTPServer module.Advantage of this approach is python is by default installed on all Linux distributions. No need to install any additional package.
Here is how to do it
- From the command shell, go to the directory you want to share. For example if you want to share “/usr/home/john/files” . $ cd /usr/home/john/files
- Run following command to share files. This command starts the webserver on port 8080 with directory browsing enabled . $ python -m SimpleHTTPServer 8080
- On your windows box point your any Webrowser to http://<linux_machine_ip>:8080 . This will list all the files present on the Linux box . Now select any files download to windows.
- Setting up of CIFS share on Linux Using Samba Server.
- Setting up FTP server on Ubuntu
- SSH server on Ubuntu.
- WinSCP free secure copy client for Windows.
- Command line secure copy client for Windows
- Python SimpleHTTPServer module documentation