Sunday, March 29, 2009

Creating Samba shares with no username or password in Ubuntu Linux

Samba sometimes frustrates me. It seems to be very picky about under what circumstances it will actually let you broadcast the existence of your Linux machine on your LAN, and share a folder with read and write permissions for other Linux or Windows users to see.

After a little tinkering, here's how I went about doing just that.

(thanks to for most of the tips)


(1) Make sure you have Samba installed. As far as I remember, it is included with most distributions, but just in case, try this --

sudo apt-get install samba

(2) Now you need to modify the Samba configuration file located at /etc/samba/smb.conf and make some changes to remove the necessity to type in a username and password every time you wish to access a share. Run --

sudo gedit /etc/samba/smb.conf

(3) At some point, you might want to share a folder that does not belong to you on the network. To allow this, under the [global] section of this file, add (copy + paste) the following line --

usershare owner only = False

(4) Find the variable "security" (in the global section) and ensure that it is set to "share". The security line should look like this --

security = share

(if you absolutely can't find the security variable anywhere, add it to the file under the global section)

(5) Find the variable "guest account" (in the global section) and ensure that is set to "nobody". The guest account line should look like this --

guest account = nobody

(if you absolutely can't find the guest account variable anywhere, add it to the file under the global section)

(6) One guide I found said that since you are making Samba security insecure, you should ensure that only your local network can access the Samba service. I personally did not end up keeping this line in my smb.conf, because I did not seem to have any success getting Samba up and running by adding this to the config file, but you can (and probably should) at least try this to make sure it works. So go ahead and add this in, and if you can't access Samba/any shares after finishing the guide, remove the line altogether (or make sure you have permitted the right interface to bind).

To try this, you need to set the interfaces variable to lo and your local network interface (e.g eth0, eth1, wlan0) and you need to specify that only these interfaces can bind

interfaces = lo eth0
bind interfaces only = true

(7) Now, smb.conf should be set. Restart the samba daemon like this --

sudo service samba restart

(8) At this point, you have two options to add a shared folder on your machine. There's the easy way, that actually seems to work, and there's the hard, theoretical way, that I havn't had any sucess why. I'll go over the easy way first.

The easy way to share a folder is similar to the way you share a folder in Windows. All you need to do is right click on the folder in the question, press "Sharing Options", and fill out the resulting dialog. I recommend the following options --

At this point, you should be done. Congratulations. You should be able to access your shared folder by browsing your workgroup from another machine (Windows or Linux-based).

As far as I know, the name of your server is the host name of your computer, truncated to 15 characters. For example, the host name of my computer is andrew-laptop-mint. I can access my samba shares from Windows, for example, with \\andrew-laptop-m\Share (for example). You can get your host name by simply opening up a terminal and typing in hostname.

EXTRA: Here's the hard, theoretical way to add a shared folder in Samba --

(1) Run the following --

sudo gedit /etc/samba/smb.conf

(2) Near the bottom of the file, or where the other entires of this sort seem to be, add the following text (replacing generic items I've written in with your own variables, of course)

path = /folder/to/share
comment = Insert comment here
read only = no
available = yes
browseable = yes
writable = yes
guest ok = yes
public = yes
printable = no
share modes = no
locking = no

(3) Run this --

sudo service samba restart

(4) You should have a shared folder now, although I can't say I've had any success with this. What's even more interesting is that the "Sharing options" method I described above doesn't seem to add anything of this sort to smb.conf. I don't know what's going on, maybe someone can enlighten me.

Good luck!


oes tsetnoc said...

I noticed performance problems with Sun's samba build on S10U4. On 100 Mbit network - 700 MB file over samba was copied about 5-6 min. and over FTP just 1:46 min.
Do you know anything about this? Can I resolve this problem with build my own samba from sources?

tominsf said...

Thank you!!! I've been trying to figure out for a couple of years (maybe not full time, I admit) how to get my W98 machine to see the Ubuntu shares in my network. I could go in the other direction, but the W98 machine would always ask for a password I couldn't supply. It works now, and this is the only thing I've found on the web that makes it work.

Kyle Wheat said...

Found this same set of tips in our Samba manual at work. Generally its frowned upon to set generic shares up with guest access, but in a home setting, I give it my blessing. Generally you have your smb shares being authenticated against an LDAP or Kerebos system and you're covered. there. Nice tutorial.

Anonymous said...

hotel economici hotel lord, gateway hotel, janes hotel republique hotel hotel coupons, hotels accomodation, hotel london deals hotel cafe hotel economici, hotel lord, janes hotel buy viagra canada buy viagra 50mg, buy viagra online uk house deal accommodation in france, cathay business class, double booking

viagra online said...

I have notice that sharing folders to other Linux machines sometimes is not an easy task even when you get the read and write permissions

Anonymous said...


I begin on internet with a directory

buy generic cialis online said...

Well worth to read this article, thanks for sharing this information. With this article you offered me got a chance to know about this, anyway i say Great Article! and waiting for you next article about this interesting subject.

Dave said...

These kind of post are always inspiring and I prefer to read quality content so I happy to find many good point here in the post, writing is simply great, thank you for the post penis enlargement penis enlargement pills VigRX Plus