Update 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:
- 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.)
- Do not right-click on the drive and go into the sharing options via the drive’s properties. This will not work.
- 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”)
- 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”.)
- Open a Terminal session and run the Samba GUI from the command line with
# sudo system-config-samba
- File|Add Share
- Browse for the drive you wish to share and select it
- Change the share name if you’d like to. (For this example my share name is “Media01”)
- Check “Writeable” if you wish to be able to write to this drive from other computers on the network.
- Check “Visible” if you’d like others to see the share while browsing the network.
- 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.)
- Click OK (You should be done at this point but you’re not. This is what caused me the most headaches to find.)
- Back at the command line:
# cd /etc/samba
# sudo pico smb.conf
(Feel free to use the editor of your choice. I like Pico.)- Scroll to the bottom of the file. There you should find
[Media01]
(remember that’s the name of the share I created.) - 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.) - Save the edited file.
# 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.
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!
thanks!!!
I especially appreciated the step by step explanation.
Thanks!! Was beginning to drive me mad!
Thankyou! Very helpful! W7 was saying that it couldnt access it, even though it could see it…
Many, many thanks from Holland (Europe)! Tried it for month and coudn’t found out what was wrong! You saved my day!!
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!
Thanks from Brazil!
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! 😀
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
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
Thanks from Brazil * 2!!!!!
Saved me some major headache …thanks.
Thank you and bless you 🙂
Worked like a charm.
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.
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
ok! i solve my problem..
i wrong the username on force user 😀
i’m sorry!!
“force user = username” did the trick. Great!
Thanks from from a Swiss in Thailand.
Thank you very much for this!
Merci bcp !!!!
Thank you. I search long time to get an answer to WHY it didn’t work and you hit it !
Awesome tutorial… fast an easy to accomplish.. thank you.. I’m learning a lot with this.
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!
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
That really works!. Amazing! Thanks.
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.
Thanks a ton!! .I was going mad over this for months.
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 !
This worked and I am as happy as I can be! Been struggling with this for a long time. 🙂
Alejandro
Tks! You help me a Lot
Thanks so much from Denmark. Driving me nuts, but now it works like a charm!!!
Allan
Working great! Thanks for one stop solution.
Thanks a bunch from Berkeley, CA!
Doesn’t seem to work. Still can’t see the share on the Windows based machines. Any ideas?
Exactly followed the steps provided here. It worked very well on Ubuntu 14.10
Again, Exactly followed the steps provided here. It worked very well on Ubuntu 14.04
I had high hopes for this on my Ubuntu 16.04. Sadly, it did not work. :-/
Did not work on my kodibuntu, any other ideas?
Thank You so much that worked fine!!
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.
it works also on 16.04!
although command “sudo restart smbd” doesnt work
workaround:
“sudo service smbd stop”
and then
“sudo service smbd stop”
*sudo service smbd start
Thank you very much for this!
The GUI you speak of does not exist.
Thanks for this.
Thanks Excellent 🙂
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.
Thank you so much buddy!!!
Thanks a lot!
Thanks buddy, your advice/guide has been really useful.
This is still useful today on Ubuntu 18.04. I was breaking my head over this for a few days now and gave up in the past trying to share a folder from my external drive on Ubuntu to access from Windows 7/10 w/ no luck. What worked for me on this was to add force user = user (used to logged in to ubuntu) to the /etc/samba/smb.conf file.
Thanks for the contribution. As I can see from the comments it has helped many over the years.