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

...

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

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

Complete!
> yum install samba-client

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

...

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

Complete!

 

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

 76
 77 ;   netbios name = MYSERVER

 78

 79 ;   interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24
 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

289
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.

 

4.Restart

 

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

The Dangers of HTML5: WebSockets and Stable Standards
New HTML5 technologies like WebSockets offer some amazing new opportunities for Web developers. But they also show how implementing unstable standards may cause more harm to a site than the benefits of the technology. What is the role of browsers and how should developers plan for when developing with HTML5?
2011-05-09T21:00:23-04:00

Internet Explorer 6: What Have We Learned?
IE6 shipped more than 10 years ago, but its non-standard implementation of the shifting standards of 2001 still haunts today's developers. As the Web shifts to HTML5, and new versions of IE, Firefox and Chrome debut, have we learned the lessons of IE6?
2011-05-09T20:50:33-04:00

Crank Up the Volume with HTML5 Music
With HTML5, music is making a comeback on the Web. Create amazing music site experiences where adding an audio file is as simple as inserting an image and users have more pause and play music outside a browser. The introduction of the tag eliminates the need for external music players, allowing for true integration of sound in your website.
2011-05-09T20:44:42-04:00

Dojo.behavior: Write Modularized HTML Document Event Handling
The dojo.behavior module provides a simple and lightweight mechanism for listening to HTML document events. Find out what makes dojo.behavior one of the best event handling mechanisms around.
2011-04-27T14:11:59-04:00

The Dojo Publish/Subscribe Event Mechanism
Learn how to use the Dojo Toolkit's versatile ContentPane widget to load dynamic content into your Web pages.
2011-04-25T07:04

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 client’s website to show up in search res...

Read more...



"sm bus" drivers missing in Device Manager

Posted Thursday, 18 March 2010 at 20:51 by Andrew Liu


When installing a new Windows XP installation, I seemingly always miss some drivers. One that troub...

Read more...



Link Building SEO Strategies

Posted Monday, 08 March 2010
Updated Tuesday, 09 March 2010 at 02:09 by Andrew Liu


Link building might be a necessary step for your search engine optimisation campaign, but very few p...

Read more...



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...

Read more...



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...

Read more...



Read more blogs...