欢迎光临
我们一直在努力

OpenSuSe 13.1中的Samba服务器配置

OpenSuSe中的Samba服务器配置13.1

版本1.0
作者:Srijan Kishore

本指南介绍了如何使用匿名和安全的samba服务器在Opensuse 13.1中配置samba服务器。 Samba是一个开源/免费软件套件,可为SMB / CIFS客户端提供无缝文件和打印服务。 与其他SMB / CIFS实现不同,Samba可以免费使用,并允许Linux / Unix服务器和基于Windows的客户端之间的互操作性。

我不会保证这将为您工作!

1初步说明

我有新安装的Opensuse 13.1服务器,我将在其上安装samba服务器。 当然,您需要有一台Windows机器来检查必须使用Opensuse 13.1服务器可以访问的samba服务器。 My Opensuse 13.1服务器的hostname server1.example.com &IP为192.168.0.100

您可以从教程的起始五章安装opensuse 13.1服务器。

注意:

  • Windows机器必须在同一个工作组上。 要检查Windows机器中的值,请在cmd提示符下运行命令

net config workstation

会是这样的

您的Windows机器必须与Openensuse 13.1服务器相同的Workstation域,即我工作中的WORKGROUP

  • 要使Windows机器在Windows中可以进行如此进行。 在运行终端并添加您的服务器IP地址的条目

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

在我的情况下,就是这样,只是保存值。

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

2匿名Samba分享

首先,我将解释安装Samba与匿名分享的方法。 要安装samba run,

zypper install samba samba-client

它会要求你的输入

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

它将安装samba 版本4.1.6-3.18.1-3208-SUSE-oS13.1-x86_64

现在在配置samba 之前编辑文件/etc/samba/smb.cnf 进行更改之前,我将把原始文件备份为 /etc/samba/smb.cnf.bak

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

进一步给出这样的条目

vi /etc/samba/smb.cnf

[global]      
workgroup = WORKGROUP
passdb backend = tdbsam
server string = Samba Server %vnetbios name = opensuse security = usermap to guest = bad userdns proxy = no#============================ Share Definitions ============================== [Anonymous]path = /samba/anonymousbrowsable =yeswritable = yesguest ok = yesread only = no

mkdir -p /samba/anonymous

systemctl restart smb.service

现在,您可以访问windowsuse中的opensuse 13.1共享,如下所示:

从Windows机器只是浏览文件夹并尝试创建一个文本文件,但你会得到一个权限被拒绝的错误。

检查共享文件夹的权限。

root @ server1:〜#ls -l / samba /
共4
drwxr-xr-x 2根根4096 5月29日18:17匿名
root @ server1:〜#

允许匿名用户授予权限如下:

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#

现在匿名用户可以浏览并创建文件夹内容。

您也可以在服务器上检查内容。

server1:/samba # ls -l anonymous/
total 0
-rwxr–r– 1 nobody nobody 0 May 29 16:37 anonymous_test.txt
server1:/samba #

3.安全的Samba服务器

为此,我将创建一个组smbgrp和用户srijan以正确的身份验证访问samba服务器

groupadd smbgrp

useradd srijan -G smbgrp

smbpasswd -a srijan

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

现在创建文件夹viz 保护/ samba文件夹中,并给出这样的权限

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

再次将配置文件编辑为:

vi /etc/samba/smb.conf

[secured] path = /samba/secured valid users = @smbgrp guest ok = no writable = yes browsable = yes

systemctl restart smb.service

进一步交叉检查设置检查如下:

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

现在在Windows机器上检查文件夹现在具有正确的凭据

你会再次面临权限的问题给用户srijan的写权限:

cd /samba
chown -R srijan:smbgrp secured/

现在samba用户srijan有权写入文件夹。干杯你在Openensuse 13.1中做了samba服务器

赞(0) 打赏
未经允许不得转载:老赵部落 » OpenSuSe 13.1中的Samba服务器配置
data-ad-format="auto" data-full-width-responsive="true">

评论 抢沙发