fbpx

Samba server supports the integration of Windows and Unix / Linux computers . For example, files can be exchanged or printers can be shared. The name Samba originates from the Server Message Block (SMB) protocol , which is used in Windows for network-based data exchange. Currently, instead of SMB again and again from the ” Common Internet File System ” (CIFS) spoken. CIFS is an evolution of SMB and was originally developed by Microsoft.

Detailed information about Samba / CIFS in German is available online from Oreilly. It is accessible under Oreilly Samba 2nd edition . In addition, the Ubuntu community provides detailed documentation regarding Samba: Samba Community . This article introduces the basics of using a Samba server set up on an Ubuntu 10.04 LTS .

server

installation

On the server, the samba package is installed, so that a file and print server can be set up:

apt-get install samba

configuration

The central configuration file can be found at

sudo vi /etc/samba/smb.conf

again. A number of information on how to configure the Samba server using this file is provided by the associated man page:

smb.conf

The file is divided into several sections. The global section ([global]) contains the basic settings, this can be followed by other sections for the release of resources.

As the first configuration step, the following line is commented out in the “Authentication” section:

# "security = user" is always a good idea. This will require a Unix account 
# in this server for every user accessing the server. See 
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html 
# in the samba-doc package for details. 
   security  = user

These security measures require an existing user on the server to access the Samba shares.

Network interfaces

If your server has several network interfaces, it may be that the smb server is bound to the wrong interface. To do this, in the “[global]” area of the smb.conf, the line

interfaces  = 192.168.1.1/24

be inserted. In this example, the smb server listens for the address range in the 192.168.1.1/24 network.

Add smb password

The following command creates an smb password for the existing user “smbuser”. The fact that this step is carried out for an existing user is important because every smb user needs a valid account on the server. With the assigned password the smb-share can be accessed later:

sudo smbpasswd -a smbuser

Since the smb password does not have to match the password of the actual account, it can be quite complex to manage the different passwords. Under Ubuntu there is the package “libpam-smbpass”, which can be used to keep the Linux and smb passwords in sync.

For changes to take effect, the server must reload the configuration:

sudo service smbd reload

Previously, the modified settings can also be checked for correctness:

testparm /etc/samba/smb.conf

Add a resource

The following configuration example releases the home directories of the smb users. The first step is to add a new resource in the smb.conf file:

sudo vi /etc/samba/smb.conf

For this purpose, the following section is commented out:

# Un-comment the following (and tweak the other settings below to suit) 
. This will share each 
# user's home directory as \\ server \ username 
[ homes ] 
   comment  = Home Directories
    browseable  = yes

Now the home directories are accessible to all users, ie the users can access each other’s user directories (assuming of course that an smb password has been set and the user thus has access to the smb server). The browseable parameter allows Windows users to browse the Samba share using Windows Explorer. To be more restrictive about the home directories, the following line can be commented out:

# By default, \\ server \ username shares can be connected to anyone 
# with access to the samba server. Un-comment the following parameter 
# to make sure that only "username" can connect to \\ server \ username 
# This might need tweaking when using external authentication schemes 
   valid users  = % S

Then, for example, the user “tktest” no longer accesses the home directory of “smbuser” (from the client’s point of view):

sudo mount -t smbfs //192.168.56.101/smbuser / media / -o username = tktest
Password: 
mount error ( 13 ) : Permission denied

Further security measures are presented eg under Samba Security (help.ubuntu.com) or Securing samba (samba.org).

client

installation

The client requires the following package to access the smb server:

sudo apt-get install smbfs smbclient

With the smbclient a first connection test can be carried out:

smbclient -U smbuser -L 192.168.56.101

Insert smb share

With the mount command, the smb directory can then be integrated locally:

sudo mount -t cifs //192.168.56.101/smbuser/media/ -o username = smbuser

After this command, the smb directory is accessible from / media /.

Categories: Tutorials

0 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.