The Travelin' Librarian Tech How to share an external USB hard drive from Ubuntu to a Windows network

How to share an external USB hard drive from Ubuntu to a Windows network

tux_windowsUpdate 25 July 2015:
I’ve just had to replace my media server and re-perform these instructions. Somewhat surprisingly they hold up under my current Ubuntu 14.02 LTS/Windows 8.1 setup. I’ve also made small changes to the text which now has you launching the Samba Configuration GUI from the command line instead of from the Gnome menus as the original version wasn’t all that much help if you weren’t running Gnome Classic.

***

I’m in the process of taking an old desktop and turning it into the house’s media server, taking most of the grunt work off of the computer I use to do my “real work” on. The media server is currently running Ubuntu 13.04 and it was sharing the small 80GB internal hard drive across my Windows network just fine. However, when I attached an external 3TB USB drive to the server, it was recognized, and I could right-click on it and tell it to share, but when I tried to access it from the Windows machine in the living room, it would not give me access. Many Google searches later I assembled the correct steps to get it to work. So, as a record for next time, and in hopes of helping someone else with some specific instructions, here they are:

  1. Connect and mount the drive to the Ubuntu computer. (The format of the drive, NTFS vs EXT4, doesn’t seem to matter for this to work so I ended up formatting it as NTFS for future portability.)
  2. Do not right-click on the drive and go into the sharing options via the drive’s properties. This will not work.
  3. Make sure you have Samba installed. (You can find it in the Ubuntu Software Center titled “SMB/CIFS file, print, and login server for Unix”)
  4. Install, if you haven’t already, install the Samba GUI. (Also in the Ubuntu Software Center titled “Samba” with a description of “Create, modify, and delete samba shares”.)
  5. Open a Terminal session and run the Samba GUI from the command line with # sudo system-config-samba
  6. File|Add Share
  7. Browse for the drive you wish to share and select it
  8. Change the share name if you’d like to. (For this example my share name is “Media01”)
  9. Check “Writeable” if you wish to be able to write to this drive from other computers on the network.
  10. Check “Visible” if you’d like others to see the share while browsing the network.
  11. On the Access tab, select “Allow access to everyone” (This will avoid the problems of having to specify usernames and passwords in programs like XMBC and MediaPortal.)
  12. Click OK (You should be done at this point but you’re not. This is what caused me the most headaches to find.)
  13. Back at the command line:
  14. # cd /etc/samba
  15. # sudo pico smb.conf (Feel free to use the editor of your choice. I like Pico.)
  16. Scroll to the bottom of the file. There you should find [Media01] (remember that’s the name of the share I created.)
  17. Add the following new line in that section: force user = username (In my case username is “msauers” since that’s the username I log in to Ubuntu with. Replace with your username.)
  18. Save the edited file.
  19. # sudo restart smbd (restarts Samba)

That should do it. You should now be able to access the shared drive from any Windows computer on your network.

48 thoughts on “How to share an external USB hard drive from Ubuntu to a Windows network”

  1. markus says:

    Thanks Michael, you saved me. Couldn’t figure out why the storage disk diden open as a shared disk from Win7. After days of googeling and trying everything out there I was about to give up ubuntu. Then I found this and it worked for me! Thanks!

  2. aaron says:

    thanks!!!
    I especially appreciated the step by step explanation.

  3. Adam says:

    Thanks!! Was beginning to drive me mad!

  4. tim says:

    Thankyou! Very helpful! W7 was saying that it couldnt access it, even though it could see it…

  5. Kasander says:

    Many, many thanks from Holland (Europe)! Tried it for month and coudn’t found out what was wrong! You saved my day!!

  6. nader says:

    Thank you so much! This trick allowed me to share my external hard drive files and the files saved in my windows 7 partition. This information should be more easily found, and the samba gui should assume the force user permission. Thanks again!

  7. Johnny says:

    Thanks from Brazil!

  8. Flint says:

    I’ve tried almost every website looking for answers – Ubuntu Forums, Superuser, etc – everywhere! They all told me to set up Samba CLI and then sharing it and I wasn’t able to.

    Thanks a lot man. I owe you one! 😀

  9. Keith says:

    Michael,

    As someone from just west of you I thank you for your clear, concise directions. Step-by-step and now I can see the drives on my Win7 machine (albeit after typing the IP address into the Win Explorer bar – but that’s another troubleshooting).

    Now, on to setting up the access to the NAS for the media server.

    Next time I’m doing work in Lincoln, I’ll buy you a drink!

    KATrimels
    Cheyenne, WY

  10. I couldn’t get it to work until I followed these added instructions in the Ubuntu store for 14.04 – Thanks for getting these instructions together – I definitely wouldn’t have been able to get it to work without them.

    Fix For Ubuntu 14.04 .. Make sure Samba is not installed. Then open terminal & type “sudo apt-get install gksu” (Without The Quotes).

    Then type gksu-properties

    In the dialogue that follows set authentication mode to “sudo” and grab mode to “enable”

    Now Install Samba everything should be working & it show up on Unity Bar & Search.

    Basically its the same steps Trevor Lane Ray did for 13.04

  11. Sergio says:

    Thanks from Brazil * 2!!!!!

  12. Des says:

    Saved me some major headache …thanks.

  13. Alex says:

    Thank you and bless you 🙂
    Worked like a charm.

  14. abderahmane says:

    thanks a lot man.

    it;s hard for us newbie to understand what’s going on with that new os we<re trying and it<s thanks to these tutorials that we get to now a little more about linux.

  15. francesco says:

    hi!!
    i try to share my hhd with my android smartphone (use es file explore on my nexus)
    but the phone give me this results:
    access failed, it may caused for:
    – wlan off
    – the server smb not accessible
    – invalid IP address
    – blocked from firewall
    – the service smb is off.

    please help meeee!!

    thank u very much

  16. francesco says:

    ok! i solve my problem..
    i wrong the username on force user 😀
    i’m sorry!!

  17. Andreas says:

    “force user = username” did the trick. Great!
    Thanks from from a Swiss in Thailand.

  18. Thank you very much for this!

  19. John G says:

    Merci bcp !!!!

    Thank you. I search long time to get an answer to WHY it didn’t work and you hit it !

  20. Luis says:

    Awesome tutorial… fast an easy to accomplish.. thank you.. I’m learning a lot with this.

  21. David C says:

    Thank you Michael,

    I had been using a RT-N56U wireless router to share a USB drive, but after a firmware upgrade the feature no longer works. So after a bit of searching I came upon your article, which worked like a charm in Ubuntu 12.04!

  22. Egor says:

    Thank you, Michael
    That’s an elegant fix for the external usb drive sharing problem i had on my ubuntu 14.04, your solution in 1 minute saved me after hours (!) of tries and googling.
    Egor / Kiev

  23. Eduardo says:

    That really works!. Amazing! Thanks.

  24. Dave Slater says:

    I tried Linux about a year ago but gave up because I could not enable a home network with 1 linux and 4 xp machines. Thanks to all the folks who made Unbutu 14.04 LTS work so much better than what I tried to use before. Thanks so very much to you Mr. Sauers for gathering and publishing just what I needed to finish the networking! Now I am at 3 linux and 2 xp machines.

  25. srini says:

    Thanks a ton!! .I was going mad over this for months.

  26. steph291 says:

    External media are problem when you are a simple user
    with now rights.

    But for me it was simple :
    -Linux Debian Jessie with Mate
    -Samba installed and configure in the same workgroup
    -Add user to samba “smbpasswd -a someuser”
    -then in term(cli) while in Mate
    sudo “filemanager_share_integrated_fonctionnality”
    (like caja, the Mate default file manager)

    Then share what is in the /media directory
    my 2 EC !

  27. Alejandro says:

    This worked and I am as happy as I can be! Been struggling with this for a long time. 🙂

    Alejandro

  28. Dan says:

    Tks! You help me a Lot

  29. Allan says:

    Thanks so much from Denmark. Driving me nuts, but now it works like a charm!!!

    Allan

  30. Pranav Sahasrabudhe says:

    Working great! Thanks for one stop solution.

  31. Sungsoon Park says:

    Thanks a bunch from Berkeley, CA!

  32. Scott says:

    Doesn’t seem to work. Still can’t see the share on the Windows based machines. Any ideas?

  33. Gowrishankar says:

    Exactly followed the steps provided here. It worked very well on Ubuntu 14.10

  34. Simon says:

    Again, Exactly followed the steps provided here. It worked very well on Ubuntu 14.04

  35. Lilly Allison says:

    I had high hopes for this on my Ubuntu 16.04. Sadly, it did not work. :-/

  36. Ryan says:

    Did not work on my kodibuntu, any other ideas?

  37. LIC says:

    Thank You so much that worked fine!!

  38. Yuri says:

    a couple of things:

    1) in the bottom of smbd.conf – uncomment “Browseable”
    Otherwise you cannot browse the shared volume – same “You do not have permission” error.

    2) Restart smbd service via init.d as restart smbd did not work. So i did /etc/inid.d/smbd stop followed by /etc/init.d/smbd start

    Worked fine after that.

  39. get2b says:

    it works also on 16.04!
    although command “sudo restart smbd” doesnt work
    workaround:
    “sudo service smbd stop”
    and then
    “sudo service smbd stop”

  40. get2b says:

    *sudo service smbd start

  41. Russell says:

    Thank you very much for this!

  42. Mansake Labs says:

    The GUI you speak of does not exist.

  43. Ray says:

    Thanks for this.

  44. Venkat says:

    Thanks Excellent 🙂

  45. John says:

    Overall prime content shared. Thank you man. Saved me lots of hours research in vain. Work on Ubuntu 16.04 sharing an external hard drive.

  46. Sinan Aydin says:

    Thank you so much buddy!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.