0% found this document useful (0 votes)
16 views14 pages

Samba Server Installation and Configuration On OpenSuSe

Samba is a utility suite that enables Linux systems to share files and printers with Windows systems, allowing for configurations as a Primary Domain Controller (PDC) or a Windows Workgroup server. This document details the installation and configuration of Samba on OpenSuse, including setting up both anonymous and secured sharing options, managing the Samba daemon, and editing the main configuration file. It also provides step-by-step instructions for creating user groups, managing permissions, and troubleshooting common issues.

Uploaded by

Samuel NDATIMANA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views14 pages

Samba Server Installation and Configuration On OpenSuSe

Samba is a utility suite that enables Linux systems to share files and printers with Windows systems, allowing for configurations as a Primary Domain Controller (PDC) or a Windows Workgroup server. This document details the installation and configuration of Samba on OpenSuse, including setting up both anonymous and secured sharing options, managing the Samba daemon, and editing the main configuration file. It also provides step-by-step instructions for creating user groups, managing permissions, and troubleshooting common issues.

Uploaded by

Samuel NDATIMANA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

SAMBA SERVER

Introduction

Samba is a suite of utilities that allows your Linux box to share files and other resources, such as printers, with
Windows boxes. This describes how you can make your Linux box into a Windows Primary Domain Controller
(PDC) or a server for a Windows Workgroup. Either configuration will allow everyone at home to have:

 Their own logins on all the home windows boxes while having their files on the Linux box appear to be located
on a new Windows drive
 Shared access to printers on the Linux box
 Shared files accessible only to members of their Linux user group.

What's the difference between a PDC and Windows Workgroup member? A detailed description is beyond the scope
of this chapter, but this simple explanation should be enough:

 A PDC stores the login information in a central database on its hard drive. This allows each user to have a
universal username and password when logging in from all PCs on the network.
 In a Windows Workgroup, each PC stores the usernames and passwords locally so that they are unique for each
PC.

This chapter will only cover the much more popular PDC methodology used at home. By default, Samba mimics a
Windows PDC in almost every way needed for simple file sharing. Linux functionality doesn't disappear when you
do this. Samba Domains and Linux share the same usernames so you can log into the Samba based Windows domain
using your Linux password and immediately gain access to files in your Linux user's home directory. For added
security you can make your Samba and Linux passwords different.

When it starts up, and with every client request, the Samba daemon reads the configuration file /etc/samba/smb.conf
to determine its various modes of operation. You can create your own smb.conf using a text editor or the Web-based
SWAT utility which is easier. Keep in mind, however, that if you create /etc/samba/smb.conf with a text editor then
subsequently use SWAT to edit the file, you will lose all the comments you inserted with the text editor. I'll explain
how to use both SWAT and a text editor to configure Samba later in this chapter.

Download and Install Packages


Most RedHat and Fedora Linux software products are available in the RPM format. Downloading and installing
RPMs isn't hard

Samba is comprised of a suite of RPMs that come on the Fedora CDs. The files are named:

 samba
 samba-common
 samba-client
 samba-swat

When searching for the file, remember that the RPM's filename usually starts with the RPM name followed by a
version number as in samba-client-3.0.0-15.i386.

Managing the Samba Daemon

Managing the samba daemons is easy to do, but the procedure differs between Linux distributions. Here are some
things to keep in mind.

 Firstly, different Linux distributions use different daemon management systems. Each system has its own set of
commands to do similar operations. The most commonly used daemon management systems are SysV and
Systemd.
 Secondly, the daemon name needs to be known. In this case the names of the daemons are smb and nmb.

Armed with this information you can know how to:

 Start your daemons automatically on booting


 Stop, start and restart them later on during troubleshooting or when a configuration file change needs to be
applied.

Note: Remember to configure your daemon to start automatically upon your next reboot.

Note: Unlike many Linux packages, Samba does not need to be restarted after changes have been made to its
configuration file, as it is read after the receipt of every client request.

The Samba Configuration File


The /etc/samba/smb.conf file is the main configuration file you'll need to edit. It is split into five major sections,
which Table 1 outlines:

Table 1: File Format - smb.conf

Section Description

[global] General Samba configuration parameters

[printers] Used for configuring printers

[homes] Defines treatment of user logins

[netlogon] A share for storing logon scripts. (Not created by default.)

[profile] A share for storing domain logon information such as "favorites" and desktop icons. (Not created by
default.)

Samba server Configuration on OpenSuse

This guide explains how to configure samba server in OpenSuse 13.2 with anonymous & secured samba servers.
Samba is an Open Source/Free Software suite that provides seamless file and print services to SMB/CIFS clients.
Samba is freely available, unlike other SMB/CIFS implementations, and allows for interoperability between
Linux/Unix servers and Windows-based clients.

1 Anonymous samba sharing

First I will explain the methodology to install the samba with the anonymous sharing. To install samba run,

zypper install samba samba-client

It will ask for your input


server1:~ # zypper install samba samba-client
Loading repository data...
Reading installed packages...
Resolving package dependencies...

Problem: patterns-openSUSE-minimal_base-conflicts-13.2-13.6.1.x86_64 conflicts with samba-client provided by


samba-client-4.1.6-3.18.1.x86_64
Solution 1: Following actions will be done:
do not install samba-client-4.1.6-3.18.1.x86_64
do not install samba-4.1.6-3.18.1.x86_64
Solution 2: deinstallation of patterns-openSUSE-minimal_base-conflicts-13.2-13.6.1.x86_64

Choose from above solutions by number or cancel [1/2/c] (c):<--2


Resolving dependencies...
Resolving package dependencies...

The following 41 NEW packages are going to be installed:


cifs-utils cups-libs libarchive13 libdcerpc0 libdcerpc-binding0 libfam0
libgensec0 libjbig2 libjpeg8 libldb1 libndr0 libndr-krb5pac0 libndr-nbt0
libndr-standard0 libnetapi0 libpdb0 libregistry0 libsamba-credentials0
libsamba-hostconfig0 libsamba-util0 libsamdb0 libsmbclient0 libsmbclient-raw0
libsmbconf0 libsmbldap0 libtalloc2 libtdb1 libtevent0 libtevent-util0
libtiff5 libwbclient0 perl-Crypt-SmbHash perl-Digest-MD4 perl-XML-LibXML
pytalloc samba samba-client samba-libs yast2-kerberos-client
yast2-samba-client yast2-samba-server

The following package is going to be REMOVED:


patterns-openSUSE-minimal_base-conflicts

41 new packages to install, 1 to remove.


Overall download size: 11.1 MiB. After the operation, additional 32.4 MiB will
be used.
Continue? [y/n/? shows all options] (y): <--y
It will install samba with Version 4.1.6-3.18.1-3208-SUSE-oS13.2-x86_64
Now to configure samba edit the file /etc/samba/smb.cnf before making changes I will make the backup of original
file as /etc/samba/smb.cnf.bak

cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
cat /dev/null > /etc/samba/smb.conf

Further give the entries like this

vi /etc/samba/smb.cnf

[global]

workgroup = WORKGROUP
passdb backend = tdbsam
server string = Samba Server %v

netbios name = opensuse

security = user

map to guest = bad user

dns proxy = no

#============================ Share Definitions ==============================

[Anonymous]

path = /samba/anonymous

browsable =yes

writable = yes

guest ok = yes
read only = no

mkdir -p /samba/anonymous

Next add the services in boot, and start the service as:

systemctl start smb.service


systemctl start smb.service

Note: we need to allow the services to get beyond the Firewall, so we will add the services in yast2 as:

yast2
Allow the services override in firewall for Samba Client and Samba Server.
Now you can access the OpenSuse 13.2 sharing in windows as follows:

From windows machine just browse the folder& try to create a text file, but you will get an error of permission
denied.
Check the permission for the shared folder.

ls -l /samba/

server1:~ # ls -l /samba/
total 0
drwxr-xr-x 1 root root 0 Nov 11 09:41 anonymous
server1:~ #
To allow anonymous user give the permissions as follows;

cd /samba
chmod -R 0777 anonymous/
ls -l

server1:/samba # ls -l
total 0
drwxrwxrwx 1 root root 0 Nov 11 09:41 anonymous
server1:/samba #
Now anonymous user can browse & create the folder contents.
You can cross check the content at server also.

ls -l anonymous/

server1:/samba # ls -l anonymous/
total 0
-rwxr--r-- 1 nobody nobody 0 Nov 21 14:10 anonymous_test.txt
server1:/samba #

3. Secured samba server

For this I will create a group smbgrp & user user1 to access the samba server with proper authentication

groupadd smbgrp

useradd user1 -G smbgrp

smbpasswd -a user1
server1:~ # smbpasswd -a user1
New SMB password:
Retype new SMB password:
Added user user1.
server1:~ #

server1:/samba # smbpasswd -a user1


New SMB password: <--user1passwd
Retype new SMB password: <--user1passwd
Added user user1.
server1:/samba #
Now create the folder viz secured in the /samba folder & give permissions like this

mkdir -p /samba/secured
cd /samba
chmod -R 0770 secured/

Again edit the configuration file as :

vi /etc/samba/smb.conf

[...]
[secured]

path = /samba/secured

valid users = @smbgrp

guest ok = no

writable = yes

browsable = yes
systemctl restart smb.service

Further to cross-check the settings check as follows:

testparm

server1:~ # testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[Anonymous]"
Processing section "[secured]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
netbios name = OPENSUSE
server string = Samba Server %v
map to guest = Bad User
dns proxy = No
idmap config * : backend = tdb

[Anonymous]
path = /samba/anonymous
read only = No
guest ok = Yes

[secured]
path = /samba/secured
valid users = @smbgrp
read only = No
server1:~ #
Now at windows machine check the folder now with the proper credentials

You will again face the issue of permissions to give write permission to the user user1 do:
cd /samba
chown -R user1:smbgrp secured/

Now samba user user1 have permissions to write in the folder. Cheers you have done with samba server in OpenSuse
13.2
we can check the file at Ubuntu server as:

Ls -l /samba/secured/

server1:~ # ls -l /samba/secured/
total 0
-rwxr--r-- 1 user1 users 0 Nov 21 14:16 secured_test.txt
server1:~ #

You might also like