Configurating the Samba server on Slackware 12.0

March 25th, 2008  | Tags: , ,

In this topic we are going to talk about the Samba Server on Slackware 12.0. Samba is a tool that allows different operating system (such as Windows and Linux) share files.

It is widely used in server which share files among other computers. As slackware linux is a good distribution foRemoving the home shared folderr server machines, samba server on Slackware runs very well.

If you are using Slackware 12.0 and installed the package N, you probably already installed the samba server, however by default it is not initialized on Linux startup. If you do not have the samba installed yet, go to its offical website and install the latest version. Its documentation shows you how to install it from the source code.

Other Linux distribution, such as Debian, Ubuntu, Red Hat, have a different way to install samba. In this topic I will not focus on how to install samba, but how to configure it.

Even you do not use Slackware, this topic can be useful for you, because the configuration is the same for all distribution. However if you are using a friendly Linux, such as Ubuntu, it has a Shared Folder tool which can be accessed by the Gnome and make your life easier.

The goal of this topic is how to configure the samba in the slackware environment without a graphical tool, thus we are going to change the text file manually. This approach can be used for any Linux distribution.

Configurating the smb.conf file

Supposing you have installed the samba server, through its source code or the slackware installation cd, you have to edit the smb.conf file. Actually this file in fact does not exist yet, you have to go to /etc/samba directory. There you will find an example file, called smb.conf-sample. The first step is to rename this file to smb.conf.

mv smb.conf-sample smb.conf

Now you can edit the smb.conf file and get started the configuration.

You are able to edit many things, however I will show you the important parameters to start a default server.

The first parameter is the workgroup. Put the workgroup name you want for your network. In my case, I have changed it to WORKGROUP.

Right below, you will find the parameter server string. It is the name of the Windows station will see your computer. In my case I have changed it to Server Machine.

Sharing a folder

Let’s create a directory called test on the root /. We want to share this folder for every users from our internal network.

Open again the /etc/samba/smb.conf file and put the following lines:conf.

[files]
	comment = Shared folder
	path = /files/
	read only = no
	public = no

The lines above will share the folder /files/. However (red line) this directory will not be public, in other words, ther user needs a valid password to access the folder. It is a good security if you are going to keep important files shared.

You can also add other roles for access. For example, if you want that only the user jair has access to this folder, you can add the command

	valid users = jair

or if you want only the users from webmasters group access this folder, you can put the following:

	write list = @webmasters

Also, you can add a mask to the file, thus when the user creates the file through windows, it is saved in the Linux using a certain attributes. For instance:

	create mask = 755

It is useful, for instance, when you have many webmasters/developers which run the files on the server. Thus you can give them permission to access a certain shared folder (maybe inside apache directory) and they can copy/send their files to the server through the windows. If any error happens, you can check the attributes and figure out who has made the latest change in the file.

Accessing the shared folder from the Windows

Supposing you have shared a folder called /files/ and gave access only to the people from the users group. Your smb.conf file should appear like this:

[files]
	comment = Shared folder
	path = /files/
	read only = no
	public = no
	write list = @users

Before try to access the folder from the Windows, you must add the user to the samba server. Actually, you must create an user in the operation system firstly.

Add a new user to the linux, typing the following:

adduser

Complete the form and a new user is going to be created.

After that you must add the user to the samba. To do this, type the following:

smbpassword -a <your_user>

Again, type the password and the user is going to be added to samba.

You must start the samba server. Type the following in the console:

nmbd -D
smbd -D

Done. Now you are able to access the folder from the windows.Go to the network section and search for the Linux Machine. Try to access it, if an dialog box asking for user/password come up, type the user and password from the user you just added.

Done, you should be able to access the shared folder.

Removing the home shared folder

You should notified a folder with the same name from your user when you accessed the Linux server. It happens because the home shared folder is configured in the smb.conf file.

I’ve already seen people in doubt how to unshare this folder. It is a simple task.

Again, edit the /etc/samba/smb.conf file, search for the entry [homes] and comment them out. Restart the samba server (smbd restart and nmbd restart) and try to access the shared folder again in the Windows station.

Starting the Samba Server when computer starts

In Slackware 12.0, you can start the samba server giving permission to the file /etc/rc.d/rc.samba. Simply type the following:

chmod 755 /etc/rc.d/rc.samba

Restart your computer and the samba server should be initialized automatically.

We can do many other things with Samba, however the things described above are the most commons.

I hope this topic be useful for anyone.

  1. September 25th, 2009 at 23:55
    #1

    I noticed performance problems with Sun’s samba build on S10U4. On 100 Mbit network - 700 MB file over samba was copied about 5-6 min. and over FTP just 1:46 min.
    Do you know anything about this? Can I resolve this problem with build my own samba from sources?

  2. September 26th, 2009 at 08:03
    #2

    Hi Oes. Honestly I’ve never notified this performance issue. I have used Slackware as file server for a while and it always worked fine. Now I’m using Ubuntu 9.04 and it is also working fine. I advice you to build the samba from source using the latest version. If the performance issue does not resolve, tell samba team about it.

TOP