Samba Server Configuration in OpenSuSe 13.1

本文详细介绍了如何在OpenSUSE 13.1服务器上安装Samba服务器,包括匿名共享、安全性增强等步骤。通过配置smb.conf文件实现权限管理,最终确保Windows机器能正确访问和使用Samba共享资源。

https://www.howtoforge.com/opensuse-13.1-samba-server


1 Preliminary Note

I have fresh installed Opensuse 13.1 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.1 server. My Opensuse 13.1 server have hostname server1.example.com & IP as 192.168.0.100

You can have your opensuse 13.1 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.1 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 13.1	


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.1-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.1-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.1-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

mv /etc/samba/smb.cnf /etc/samba/smb.cnf.bak

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

systemctl restart smb.service

Now you can access the opensuse 13.1 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.

root@server1:~# ls -l /samba/
total 4
drwxr-xr-x 2 root root 4096 May 29 18:17 anonymous
root@server1:~#

To allow anonymous user give the permissions as follows;

root@server1:~# cd /samba
root@server1:/samba# chmod -R 0777 anonymous/
root@server1:/samba# ls -l
total 4
drwxrwxrwx 2 root root 4096 May 29 18:17 anonymous
root@server1:/samba#

Now anonymous user can browse & create the folder contents.

You can cross check the content at server also.

server1:/samba # ls -l anonymous/
total 0
-rwxr--r-- 1 nobody nobody 0 May 29 16:37 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:~ #

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:

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

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.1


Share this page:

1 Comment(s)

Add comment
p

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值