Samba server installation on OpenSuse 13.2

Version 1.0
Author: Srijan Kishore <s [dot] kishore [at] ispconfig [dot] org>
Follow howtoforge on Twitter

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 Preliminary Note

I have fresh installed OpenSuse 13.2 server, on which I am going to install the samba server. Off-course you need to have one windows machine to check the  samba server that must be reachable with the OpenSuse 13.2 server. My OpenSuse 13.2 server have hostname server1.example.com & IP as 192.168.0.100

You can have your OpenSuse 13.2 server installed from the starting five chapters of the tutorial.

Note:

  • The Windows machine must be on same workgroup. To check the value in windows machine run the command at cmd prompt

net config workstation

It will be like this



Your windows machine must be at same Workstation domain as in OpenSuse 13.2 server, i.e. WORKGROUP in my case.
  • To make the windows machine reachable in windows proceed like this. In the run terminal & add  the entry of your server IP address

notepad C:\Windows\System32\drivers\etc\hosts

In my case it was like this, just save the values.

[...]
192.168.0.100 server1.example.com opensuse


2 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 srijan to access the samba server with proper authentication

groupadd smbgrp

useradd srijan -G smbgrp

smbpasswd -a srijan

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

server1:/samba # smbpasswd -a srijan
New SMB password: <--srijanpasswd
Retype new SMB password: <--srijanpasswd
Added user srijan.
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 srijan do:


cd /samba
chown -R srijan:smbgrp secured/


Now samba user srijan  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 srijan users 0 Nov 21 14:16 secured_test.txt
server1:~ #

Cheers now we have a successfully configured samba server over OpenSuse 13.2 :)

Share this page:

1 Comment(s)

Add comment

Comments

From: Alberto

That's alot of stuff to do...

Maybe: 1.- you can change Samba settings (in KDE version) as Root (as main global settings). 2.-now then you can change the folder (as normal user in your home folder as the one you specified in Samba settings) properties with right-click so in the permissions tab you may set'em . 3.- don't forget to specified the user ( "smbpasswd -a "XXUSERXX" "Password" in terminal) or free access to anyone