Installing Samba Server

Posted Thursday, 04 March 2010 at 03:31 by Andrew Liu
Tagged: linux | networking | web development
Read more blogs...


OS: Fedora 10


Accessing a your server's filesystem directly from your windows computer can be achieved by using Samba.  Samba has been around for quite a while, and does the job admirably.  First thing we need is to install the packages.


1. Install Samba


> yum install samba

Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Resolving Dependencies


  samba.i386 0:3.2.8-0.26.fc10

  samba-common.i386 0:3.2.8-0.26.fc10    samba-winbind.i386 0:3.2.8-0.26.fc10

> yum install samba-client

Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Resolving Dependencies


  samba-client.i386 0:3.2.8-0.26.fc10



2. Basic Configuration


Once installed, we have configuration files located in "/etc/samba".  The file we want to modify "/etc/samba/smb.conf".


> vi /etc/samba/smb.conf

 74     workgroup = MYGROUP
 75     server string = Samba Server Version %v

 77 ;   netbios name = MYSERVER


 79 ;   interfaces = lo eth0
 80 ;   hosts allow = 127. 192.168.12. 192.168.13.


a) The "workgroup" / "server string" lines are equivalent to windows workgroup and computer description.  You should fill these out the workgroup to be the same on all your computers in your LAN.  Server string is just a short description.

b) "netbios name" is like "computer name" in windows, and it applies to the network only.  I think by default it uses your /etc/hostname already, but if you have a preferred computer name, different to your hostname, you should put it in here.  Otherwise, leave it commented out.


You can leave "interfaces" and "hosts allow" commented out.  This will allow anyone to access samba.



3. Creating a super public folder


I tend to like having a globally accessible folder over samba.  It just makes things less complicated.  Unless you have good reason to do otherwise, I suggest doing the same.


To do this, I create a user called "samba".  The public folder will be located in this users home directory, called "public".


> useradd samba

> cd /home/samba

> mkdir public

> chmod 777 public

> chown samba:samba public

> ls -al

total 32
drwx------ 5 samba samba 4096 2009-02-28 22:36 .
drwxr-xr-x 7 root  root  4096 2009-02-28 22:35 ..
-rw-r--r-- 1 samba samba   18 2008-12-15 22:04 .bash_logout
-rw-r--r-- 1 samba samba  176 2008-12-15 22:04 .bash_profile
-rw-r--r-- 1 samba samba  124 2008-12-15 22:04 .bashrc
drwxr-xr-x 2 samba samba 4096 2008-10-29 05:49 .gnome2
drwxr-xr-x 4 samba samba 4096 2008-11-20 06:11 .mozilla
drwxrwxrwx 2 samba samba 4096 2009-02-28 22:36 public


And now we need to add this folder to the samba configuration file.  Add your shares at the bottom as this is the most logical place to put them.


> vi /etc/samba/smb.conf

290 [public]
291 path = /home/samba/public
292 comment = Public Folder
293 public = yes
294 writable = yes

295 create mask = 0666

296 directory mask = 0777
297 force group = samba
298 valid users = @samba



Finally, we need to add a user to samba.  Samba uses its own method to authenticate users and passwords.  By using "tdbsam" (which is the default now), we simple add a user using the following command.


> smbpasswd -a samba

New SMB password:
Retype new SMB password:
Added user samba.


Remember, this password is different to the operating system password (although you can choose the same password if you wish).  It is this password that samba uses and will look for.




Restart samba services.  Its a little bit more annoying now as you have to do two commands.

> /etc/rc.d/init.d/smb restart
Shutting down SMB services:                                [  OK  ]
Starting SMB services:                                     [  OK  ]
> /etc/rc.d/init.d/nmb restart
Shutting down NMB services:                                [  OK  ]
Starting NMB services:                                     [  OK  ]



To keep things neat, I like to make a symbolic link on the filesystem from "/public" to the newly created super public folder.

> ln -s /home/samba/public /public



5. Startup Scripts


To make sure that samba starts when the system boots up, you need to add the services to the appropriate runlevels.

> chkconfig --levels 35 smb on

> chkconfig --levels 35 nmb on





Web News

Company Blog

Search Behaviour

Posted Tuesday, 19 October 2010 at 05:58 by Andrew Liu

As an SEO provider, you have one main goal. Get your clients website to show up in search results fo...


sm bus drivers missing in Device Manager

Posted Sunday, 18 April 2010
Updated Sunday, 24 February 2013 at 06:39 by Andrew Liu

When installing a new Windows XPinstallation, I seemingly always miss some drivers. One that trouble...


Multiple Domains for SEO performance?

Posted Friday, 05 March 2010 at 23:13 by Andrew Liu

Online businesses and websites that cover a broad range of topics or one large topic are sometimes b...


Tag Clouds - SEO or not?

Posted Thursday, 04 March 2010 at 04:34 by Andrew Liu

A tag cloud or word cloud is a visual depiction of tags or words related to a site, typically used t...


Mozilla Thunderbird and Gmail IMAP Attachments Bug

Posted Wednesday, 03 March 2010 at 20:15 by Andrew Liu

I've been using Gmail since its early inception, and Iwas one of the first to utilise Gmail's IMAPfe...


Read more blogs...