10

I am wondering, is there any way to easily share a folder between Linux and Windows?

  • 6
    Can you explain in depth your requirements? Otherwise, I'd have to flag as not a real question. – jrg Nov 28 '11 at 1:40
  • 3
    Do you mean sharing between machines or on the same machine? – Roman B. Nov 28 '11 at 4:02
11

Samba

If you want to share files stored on Linux Linux, install a Samba server on the Linux machine. Follow the documentation (Red Hat 6, CentOS 5, Ubuntu).

If you want to share files from Windows, your file manager on Linux can probably connect to a Windows share with no extra effort on your part. Try browsing smb:///. If you want access from the command line, run

mkdir /media/somedir
sudo mount -t cifs //servername/sharename /media/somedir

(If you need help on the Windows side, ask on a Windows site.)

  • 2
    Or use an NFS client on the MSWindows box – symcbean Nov 28 '11 at 9:26
  • this command works perfect but when I restarted the computer I had to do it again. Is there a way to do it permanently? – Tak Mar 15 '18 at 11:58
  • @Tak You can add an entry in /etc/fstab, but this is usually a bad idea with Samba, because it means your computer will get stuck while booting if the server is down. You can also set up an automounter, so that the mount is done when you try to access the directory. I don't have any pointers, search on the web or on this site and ask a new question if you can't find enough information to set it up. – Gilles Mar 15 '18 at 13:01
  • @Gilles thanks, I've posted a question here lets hope someone has a solution unix.stackexchange.com/questions/430414/… – Tak Mar 15 '18 at 15:10
7

The answer is going to depend very much on which of two questions you are actually asking.

If you want to share files and directories over a network between a PC running windows and a computer running linux that are on at the same time, Gilles' answer regarding Samba is definitely the way to go.

If you're asking how to create a partition/drive on a single dual-booting system that both your windows and linux setups can read, the easiest way is to format a partition as NTFS and use ntfs-3g to mount it in read/write mode in linux.

4

For the Linux -> Windows part, the following is my favorite:

  • python2 -m SimpleHTTPServer
  • python3 -m http.server

This opens a HTTP-Server on Port 8000 for the current directory. You can access it from Windows by typing your IP-Adress in a browser - eg. http://192.0.2.91:8000/

If you want to share a directory, you have to zip it.

  • Python is available for Windows too, so it should work the other way as well. – Oskar Skog Jul 19 '17 at 22:02

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.