Setting up Samba Server

I was trying to let a Windows computer access some multimedia files on my Gentoo laptop recently. I forgot that I hadn’t set up samba server on my most recent installation so I decided to do it and write about it at the same time. This is not a full explanation of how to configure samba, it’s just a way to help you do it as quick as possible.

Getting Samba
For Gentoo users like myself the process of installing samba is just typing:
# emerge samba
For Debian/Ubuntu users:
# apt-get install samba samba-common
For other folks you can either use your given package management tool (Suse: Yast, Mandriva: Rpmdrake, etc.) or just install the rpm directly. You can find an rpm appropriate for your system here.

Configuring Samba
There are some programs built to configure samba for you, but it’s really quite easy to edit the configuration file by hand. With root privileges open the file /etc/samba/smb.conf

My system gave me a default file that looked like this:

[global]
server string = faith
wins support = no
workgroup = SpiritNet

“faith” is my computer name and “SpiritNet” is the name of my workgroup. This much was configured automatically by some Gentoo tool. If you’re file is blank or doesn’t exist don’t worry. You should at least have a file named /etc/samba/smb.conf.example or something like it to look at as an example. Just copy what I’ve got above and change the values to match what you want.

To share a directory you’ll need the following things:

  • know the path to the folder you want to share
  • know what you want to call the samba share
  • know whether you want any anonymous user to be able to save/delete on the share

I’ll share how my smb.conf file looks after I’ve set up one share. It’s a partition mounted as /mnt/z_drive and I want it to be world-writeable.

[global]
server string = faith
wins support = no
workgroup = SpiritNet

[x_drive]
path = /mnt/x_drive
read only = no
printable = yes
guest ok = yes

After I save this file I only have to restart samba. This command may be different on your system from mine. Basically all it is is calling the samba program with a space and then the word ‘restart’. I’ll share two possible locations for samba (these are both potentially restart commands):
# /etc/rc.d/init.d/smb restart
# /etc/init.d/samba restart

This should give you a fully working samba server that people can connect to. This is only a brief overview of getting samba working and configured, but you can get a full instruction manual below:

All about samba (this page can also be optained by typing # man samba).

Leave a Reply »»

One Response to “Setting up Samba Server” »»

  1. Comment by Ryen
    05/02/05 at 1:54 am

    For ubuntu and probably most of debian based distros, samba restart comman is the sencond one,
    /etc/init.d/samba restart

    Nice intro of how to set up samba. Thanks Danger.