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

Symantec distrust to begin in Chrome from April 2018
Google's browser will start the process of removing trust from old Symantec TLS certificates in Chrome 66.
--- 28 Jul 2017 01:42 PM

Ok Google: Telstra adds Google Home to smart home offering
The telco giant has welcomed Google into its Smart Home play.
--- 28 Jul 2017 01:08 PM

Huawei reports 15 percent revenue surge for H1 2017
The networking giant generated 283.1 billion yuan in revenue during the first six months of 2017.
--- 28 Jul 2017 12:47 PM

LG posts healthy Q2 profit despite mobile setback
Marketing costs for the new G6 tinted an otherwise strong quarter for LG Electronics.
--- 28 Jul 2017 11:53 AM

Singapore should not criminalise good intent to encourage data sharing in cybersecurity
People who fear prosecution may be less willing to share threat information, which is vital in fending off attacks, and Singapore government should clearly define its proposed mandate for companies to report data breaches within 72 hours.
--- 28 Jul 2017 11:23 AM

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

Read more...



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

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



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



Read more blogs...