Installing & configuring Samba on Ubuntu/Kubuntu

mandark1967

Member
Mar 12, 2007
246
0
SAMBA on Kubuntu Edgy

This how-to assumes the following:

You use the same login name on your Windows and Linux computers.
You are using Static IPs behind your router

You use nano as your text editor. (Replace with Kate or emacs or vi or gedit or whatever editor you like)

Basically, you need to do the following:

Install Samba packages
Create your smb password for your account
Create/Modify the smbusers file
Modify the smb.conf file to enter the information for your users and the shared drives they will access.
Start the Samba Server

The process is really simple, it's just somewhat tedious.

First off, install your samba packages using Adept/Synaptic/whatever package manager you use. Kubuntu 6.10 comes with the package “samba-common” installed by default, but SAMBA is neither fully installed nor set up, so you need to grab the packages.

Installing the packages:

samba
samba-doc (so you can learn the finer points of tuning a SAMBA setup)

These additional packages may or may not be needed, but I installed them anyway:

komba2
smb4k
swat


Create/Set the smb password:

Then, you need to set your user's smb password to be the same between windows and linux by performing the following command at the command line (Terminal window)

bob@bob-samba:~$ sudo smbpasswd -a bob

In the example above, bob is the person logged in and entering the command on the machine called bob-samba.

By running the command above, bob will get prompted to create a password for a user named bob. This username should be the same login name you use to access your windows box and linux box.

Create/Modify the smbusers file:

Once you've set the smb password, you need to either modify or create the smbusers file

bob@bob-samba:~$ sudo nano /etc/samba/smbusers

In the smbusers file, modify/add the following line:

USERNAME = "network username"

USERNAME = the name you are going to use to log into the machine with. Using bob as an example, it would look like:

bob = "network username"

Save the file in your text editor and exit the editor.

Modify the smb.configuration file

bob@bob-samba:~$ sudo nano /etc/samba/smb.conf

(You can use whatever editor. I use nano since it's present in both Kubuntu and Ubuntu)

In the smb.conf file, make the following additions:

2. Locate the section titled

[global]

If the following entries do not exist, add them. If they do exist and are set to something else, modify them to read:

workgroup = MSHOME (Enter your workgroup's name here in place of MSHOME)
netbios name = bob-samba (Enter the HostName here of your *buntu box)

3. Scroll down to locate the following entry:

; security = user

Remove the ; from the entry above and add the following line directly below it

username map = /etc/samba/smbusers

4. Scroll down to the section
#================ Share Definitions =================

in that section, locate the entry labeled

[printers]

After the last entry for printers, enter the information for your shares.

(NOTE: I place my shared drive entries after the printer section because it works for me...you can put them anywhere in the Share Definitions section)

I named each of my shares in the smb.conf file to match the name of the drive as it appears in the /media/ folder. I recommend using this method for the sake of simplicity.

You can copy and paste the following bolded entries if you want. Just be sure to modify them to reflect your drive names and user names ;)



# My Shared Folders

[DRIVE1]
path = /media/DRIVE1/
browseable = yes
read only = no
guest ok = no
create mask = 0644
directory mask = 0755
force user = USERNAME
force group = USERNAME

[DRIVE2]
path = /media/DRIVE2/
browseable = yes
read only = no
guest ok = no
create mask = 0644
directory mask = 0755
force user = USERNAME
force group = USERNAME

In place of the "USERNAME" entries above, make sure USERNAME is set to the same username you use to log into the system on both Windows and Linux

The group name should be set to the groupname your linux login name is set to.

Once all these steps are complete, you can try starting up Samba and accessing the shares.

bob@bob-samba:~$ sudo testparm

Then,

bob@bob-samba:~$ sudo /etc/init.d/samba restart

You should now be able to browse the network from your windows machines and see/access/read/write to your shared Linux Drives.
 
Top Bottom