Installing and Configuring Samba on Debian 4

In this guide you will learn how to install Samba on Linux (Debian 4 / etch).
Installing Samba allows you to share files over the network for Mac, Windows and other Linux computers.

As always, first of all lets update the Aptitude source list so we get the latest version.

apt-get update

Next, lets install Samba and the client for Samba (to connect).

apt-get install samba smbclient

The configuration file can be found at /etc/samba/smb.conf.

We don’t want to use the generated file, as it’s bloated.
Its a good reference for additional parameters, but for these guide we’ll make our own.

cd /etc/samba
mv smb.conf smb.conf.old

Now lets create our own:

nano smb.conf

And in this file, put the following:

[global]

workgroup = debian
netbios name = debian server
server string = %h server (Samba %v)
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0

[WEB]

path=/var/www
browseable=yes
writeable=yes
admin users = arkinEx

Then press Ctrl+X to exit, Y to Save changes and then Enter to confirm filename.
If the file does not save, you are probably not logged in as root, so su root and try again.

As you can see, i set up Samba for my Apache/Web directory.
The [WEB] is a configuration option for a shared directory, you can change this as you need.
The admin users is the list of users whom can read & write the directory, I’ve added myself.

Once you’ve added your user to Samba and created your shared directory you will need to add a user to Samba and give it a password. No users on the machine will have access to Samba until you do this. This can be done using the smbpasswd utility:

smbpasswd -a arkinEx

Replacing arkinEx with your username, this will add the user to Samba and allow you to provide a password for them.

smbpasswd -h

For more information on this command. Alternitavely, check the smbpasswd man page.

Next, lets reload Samba:

/etc/init.d/samba restart

Now thats complete, you should be able to find your Debian server on your Mac or Windows network by entering the IP or Hostname of it.

For example, connecting to samba from Mac, on my Macintosh:

Load Finder
Go -> Connect to Server
smb://mars/WEB

And then i enter my credentials and wallah, its connected!
Don’t forget to change mars and WEB to match your Samba setup.

Hope this guide helped, don’t hesitate to post questions as comments.

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)