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

    by  • May 21, 2013 • Tech • 16 Comments

    tux_windowsI’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. Run the Samba GUI. (Applications|System Tools|Administration|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. Open a Terminal session
    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.

    About

    Michael Sauers is currently the Technology Innovation Librarian for the Nebraska Library Commission in Lincoln, Nebraska and has been training librarians in technology for more than 15 years. He has also been a public library trustee, a bookstore manager for a library friends group, a reference librarian, serials cataloger, technology consultant, and bookseller. He earned his MLS in 1995 from the University at Albany’s School of Information Science and Policy. Michael’s twelfth book, Google Search Secrets (w/ Christa Burns) was published October 2013 and has two more books on the way. He has also written dozens of articles for various journals and magazines. In his spare time he blogs at travelinlibrarian.info, runs Web sites for authors and historical societies, takes many, many photos, and reads more than 100 books a year.

    http://www.travelinlibrarian.info/

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

    1. markus
      July 9, 2013 at 3:50 pm

      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
      July 18, 2013 at 1:31 pm

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

    3. Adam
      August 4, 2013 at 4:38 pm

      Thanks!! Was beginning to drive me mad!

    4. tim
      September 2, 2013 at 3:22 pm

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

    5. Kasander
      September 22, 2013 at 5:13 am

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

    6. nader
      October 14, 2013 at 1:38 pm

      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. November 24, 2013 at 4:57 pm

      Thanks from Brazil!

    8. Flint
      August 4, 2014 at 5:06 am

      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! :D

    9. September 1, 2014 at 3:21 pm

      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. October 21, 2014 at 8:01 am

      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
      October 26, 2014 at 6:18 pm

      Thanks from Brazil * 2!!!!!

    12. Des
      October 29, 2014 at 8:48 am

      Saved me some major headache …thanks.

    13. Alex
      November 4, 2014 at 3:41 am

      Thank you and bless you :)
      Worked like a charm.

    14. abderahmane
      November 12, 2014 at 6:30 pm

      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
      November 17, 2014 at 12:13 pm

      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
      November 17, 2014 at 1:14 pm

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

    Leave a Reply

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