8下成功布置好SAMBA服务,Linux系统配置Samba文件分享

在 CentOS
操作系统下(或 Red
Hat,这里指v4.8、v5.8、v6.2或更加高版本)配置文件分享服务的法子,具体操作如下:
● 当开头具备专门的学问早前,请先确认系统有安装 samba ! 

近期斩新安装了Fedora
Core8,即便大家有宜人的rz/sz命令可用,然而像Windows一样的文件分享更有益,那也大家不得不叹服Windows的地点。同不时间,小编也供给向同事们分享小编的文件,所以决定动用SAMBA来布局笔者的分享服务。

考试情形:两台主机
服务端:192.168.56.11
客户端:192.168.56.12

可以用  rpm  -qa  |  grep  samba 来查证
要布局 samba ,首先要先编写制定 /etc/samba/smb.conf 文件 (用vi)
屏蔽(或去掉) passdb backend = tdbsam  那些选项
然后实践 smbpasswd -a root  来增添新的 samba 客商,并设置密码。
增加生产技术 samba 客商前,记得先确认在 /etc/passed 文件里有同等顾客名。
新添了 samba 客商之后,能够把 /etc/samba 目录下的 smb.conf
文件之中的内容全删掉,换来附属类小部件1所示内容。

那边带有了Centos7 里面安装的软件教程

1、使用yum命令来安装或更新您的SAMBA包。
yum install samba
2、samba的布局文件在如下
/etc/samba/smb.conf
修改其安插如下:

布署客户认证分享
服务端操作:
1.休息防火墙,关闭selunix

● 落成了以上那些大旨配置之后, service  smb restart 就足以让 samba
服务及时见效起来。
细节:我们要查一下 smb 服务是或不是留存,敲命令 chkconfig  –list 来认同。
亟需承认的是, 在 runlevel 3 和 runlevel 5 上边,smb
服务到底有未有张开起来。
假若要让服务在系统运行的时候自动启动,要求试行以下  chkconfig smb on
,反之施行  chkconfig smb off

1.使用

#======================= Global Settings

[global]

[root@hejie ~]# setenforce 0
[root@hejie ~]# systemctl stop firewalld

◎附件1:
[global]
workgroup = TUX-NET
server string =
RedHat.EL,v4 Samba
Server
map to guest = Bad User
guest account = root
[ShareRW]
comment = All users
path = /home
read only = No
create mask = 0666
directory mask = 0765
browseable = no
public = no
guest ok = no
[users]
comment = All users
path = /home
read only = Yes
create mask = 0444
directory mask = 0444
public = yes
guest ok = yes
[exchange]
comment = All users
path = /tmp
read only = No
create mask = 0666
directory mask = 0666
public = yes
guest ok = yes

rpm -qi samba

# ———————– Netwrok Related Options

#
# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
#
# server string is the equivalent of the NT Description field
#
# netbios name can be used to specify a server name not tied to the
hostname
#
# Interfaces lets you configure Samba to use multiple interfaces
# If you have multiple network interfaces then you can list the ones
# you want to listen on (never omit localhost)
#
# Hosts Allow/Hosts Deny lets you restrict who can connect, and you
can
# specifiy it as a per share option as well
#
workgroup = robin
server string = MYSERVER

netbios name = MYSERVER

; hosts allow = 127. 192.168.

2.装置软件包

美高梅开户网址 1

命令查询是还是不是早已设置了Samba。

# ————————— Logging Options

#
# Log File let you specify where to put logs and how to split them
up.
#
# Max Log Size let you specify the max size log files should reach

# logs split per machine
log file = /var/log/samba/log.%m
# max 50KB per log file, then rotate
max log size = 50

[root@hejie ~]# yum install samba-* -y

如下图所示,已经有了安装音讯,表达已经设置了samba

# ———————– Standalone Server Options

#
# Scurity can be set to user, share(deprecated) or server(deprecated)
#
# Backend to store user information in. New installations should
# use either tdbsam or ldapsam. smbpasswd is available for backwards
# compatibility. tdbsam requires no further configuration.

security = share
; encrypt passwords = yes
guest ok = yes
guest account = root

 

3.伊始smb服务并设置开机自启

美高梅开户网址 2检查实验samba是或不是安装

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

[homes]
comment = Home Directories
browseable = no
writable = yes
; valid users = %S
; valid users = MYDOMAIN\%S

[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
; guest ok = no
; writable = No
printable = yes

# Un-comment the following and create the netlogon directory for Domain
Logons
; [netlogon]
; comment = Network Logon Service
; path = /var/lib/samba/netlogon
; guest ok = yes
; writable = no
; share modes = no

# Un-comment the following to provide a specific roving profile share
# the default is to use the user’s home directory
; [Profiles]
; path = /var/lib/samba/profiles
; browseable = no
; guest ok = yes

# A publicly accessible directory, but read only, except for people
in
# the “staff” group
; [public]
; comment = Public Stuff
; path = /home/samba
; public = yes
; writable = yes
; printable = no
; write list = +staff

[8下成功布置好SAMBA服务,Linux系统配置Samba文件分享。temp]
path = /root/temp
writeable = yes
; browseable = yes
guest ok = yes

3、重启SAMBA服务
/etc/init.d/smb restart

4、Enjoy

PS:Fedora
Core从V2起都有预装SELinux,这些不会配备的能够先把她关掉,关闭的点子如下:

修改/etc/selinux/config文件中的SELINUX=”” 为 disabled ,然后重启FC。

作者:Robin 出自:

美高梅开户网址 3

[root@hejie ~]# systemctl start smb
[root@hejie ~]# systemctl enable smb
Created symlink from
/etc/systemd/system/multi-user.target.wants/smb.service to
/usr/lib/systemd/system/smb.service.

假设未有设置,使用

至于萨姆ba的布署文件

yum install samba

[root@hejie ~]# grep -Ev ‘^#|^$’ /etc/samba/smb.conf
[global]                            //全局参数     
 workgroup = SAMBA    //专门的学业组名称  特别关键
 security = user              //安全申明格局,总共几种
                                       
//share:没有须求验证身份,轻便方便,安全性差
                                       
//user:要求证实顾客密码才足以访谈,安全性高
                                       
//server:须要经过三方服务器验证账号密码,(集中处理账户)
                                       
//domain:使用域调整器实行身份验证     
 passdb backend = tdbsam    //定义客商后台的品类,共有三种
                                               
//smbpasswd:为系统客户设置Samba服务程序的密码
                                               
//tdbsam:创建数据库文件并运用pdbedit命令建构Samba服务程序的客商
                                               
//ldapsam:基于LDAP服务扩充账户注脚
 printing = cups                      //设置萨姆ba共享打字与印刷机的类型
 printcap name = cups            //设置分享打字与印刷机的布署文件
 load printers = yes               
//设置在Samba服务运行时是还是不是分享打字与印刷机设备
 cups options = raw                //打字与印刷机的选择
[homes]                                  //共享参数
 comment = Home Directories    //描述消息
 valid users = %S, %D%w%S    //允许访谈该分享的顾客
 browseable = No                        //钦赐分享消息是不是可以预知
 read only = No
 inherit acls = Yes
[printers]
 comment = All Printers        任性字符串
 path = /var/tmp                    分享目录路线
 printable = Yes                   
 create mask = 0600           
 browseable = No                  钦点该分享是或不是足以浏览
[print$]
 comment = Printer Drivers
 path = /var/lib/samba/drivers
 write list = root                        允许写入该分享的客商
 create mask = 0664
 directory mask = 0775

下载并安装。

4.增加顾客”zhengran”,不创建家目录,并设置密码。

2.现行起来新建分享文件夹的客户jc,使用命令

[root@hejie ~]# useradd -M zhengran
[root@hejie ~]# smbpasswd -a zhengran
New SMB password:
Retype new SMB password:
Added user zhengran.
假诺这里映射”zhengran”顾客为share客户,那么即就要/etc/samba/smbusers文件中增多如下内容:
    [root@hejie ~]# echo ‘zhengran = share’ > /etc/samba/smbusers

useradd jc

5.在全局配置中增加如下内容:

平日来讲,加多顾客须求root权限,使用

[root@hejie ~]# vim /etc/samba/smb.conf
[global]
        workgroup = SAMBA
        security = user
        username map = /etc/samba/smbusers      //加多此行内容
        passdb backend = tdbsam

su root

6.创制二个分享目录“zhengran”,并转移其属主属组为顾客“zhengran”

获取root权限,增加顾客成功,如下图所示。

[root@hejie ~]# mkdir /opt/zhengran
[root@hejie ~]# chown -R zhengran.zhengran /opt/zhengran/
[root@hejie ~]# ll /opt/
total 0
drwxr-xr-x. 2 zhengran zhengran 6 Aug 7 17:22 zhengran

美高梅开户网址 4增加客商

7.安排分享

3.选取命令

[root@hejie ~]# cat >> /etc/samba/smb.conf <<EOF
> [zhengran]    //共享名
> comment = zhengranwoaini    //注释音讯
> path = /opt/zhengran                //共享目录路径
> browseable = yes                    //内定该分享是还是不是能够浏览
> guest ok = yes                       
//钦点该分享是或不是同意guset账户访问
> writable = yes                          //钦定目录是不是可写
> write list = share         
//允许写入该分享的顾客,组要用@表示,举例:
                                                write list =
root,@root     
> public = yes                          //是还是不是允许无名氏访谈
> EOF

passwd jc

8.用testparm检查计划文件是或不是有语法错误,可展现最后奏效的布署

对顾客增进密码,如下

[root@hejie ~]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit
(16384)
Processing section “[homes]”
Processing section “[printers]”
Processing section “[print$]”
Processing section “[zhengran]”
Loaded services file OK.
Server role: ROLE_STANDALONE

美高梅开户网址 5修改密码

Press enter to see a dump of your service definitions

4.采取命令

# Global parameters
[global]
 workgroup = SAMBA
 printcap name = cups
 security = USER
 username map = /etc/samba/smbusers
 idmap config * : backend = tdb
 cups options = raw

mkdir /home/share

[homes]
 comment = Home Directories
 browseable = No
 inherit acls = Yes
 read only = No
 valid users = %S %D%w%S

在客户lxr文件夹下新建share分享文件夹。

[printers]
 comment = All Printers
 path = /var/tmp
 browseable = No
 printable = Yes
 create mask = 0600

5.选择命令

[print$]
 comment = Printer Drivers
 path = /var/lib/samba/drivers
 create mask = 0664
 directory mask = 0775
 write list = root

chmod -R 777 /home/share

[zhengran]
 comment = zhengranwoaini
 path = /opt/zhengran
 guest ok = Yes
 read only = No
 write list = share

将全部share文件夹与中间的公文和子目录的权能都安装为rwxrwxrwx,即全部人都足以查阅操作,如图

9.重启smb服务

美高梅开户网址 6授权文件夹

 [root@hejie ~]# systemctl restart smb

6.选取命令给smb.conf 文件做备份

顾客端上操作:
1.设置工具包

cp smb.conf smb.conf~bak

 [root@hyj ~]#  yum install samba-client cifs-utils -y

备份结果如下所示。

    在顾客机查看samba服务端有怎么着共享财富

cd /etc/samba

    [root@hyj ~]# smbclient -L 192.168.56.11 -U share
    Enter SAMBA\share’s password:
    Sharename Type Comment
    ——— —- ——-
    print$ Disk Printer Drivers
    zhengran Disk zhengranwoaini
    IPC$ IPC IPC Service (Samba 4.6.2)
    Reconnecting with SMB1 for workgroup listing.
    Server Comment
    ——— ——-
    Workgroup Master
    ——— ——-

7.用到命令

3.创建目录,并将samba服务器的分享能源zhengran挂载到客商机本地

vim smb.conf

[root@hyj ~]# mkdir /opt/ran
[root@hyj ~]# mount -t cifs //192.168.56.11/zhengran /opt/ran -o
username=share,password=123
[root@hyj ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/CentOS-root
17G 1016M 16G 6% /
devtmpfs 982M 0 982M 0% /dev
tmpfs 993M 0 993M 0% /dev/shm
tmpfs 993M 8.5M 984M 1% /run
tmpfs 993M 0 993M 0% /sys/fs/cgroup
美高梅开户网址 ,/dev/sda1 1014M 125M 890M 13% /boot
tmpfs 199M 0 199M 0% /run/user/0
//192.168.56.11/zhengran 47G 5.4G 42G 12% /opt/ran

跻身萨姆ba配置文件,按下“i”键将配置文件修改如图

4.在客商机挂载点创设新文件

比方在配备中冒出谬误,删除配置文件,继续选用备份好的布署文件就能够

[root@hyj ~]# cd /opt/ran/
[root@hyj ran]# touch 1 2 3
[root@hyj ran]# ls
1 2 3

mv smb.conf~bak smb.conf

5.在服务器上表明

继续编辑配置文件

[root@hejie ~]# cd /opt/zhengran/
[root@hejie zhengran]# ls
1 2 3

正确配置内容如下:

布署无名分享
服务端
1.修改配置文件

# See smb.conf.example for a more detailed config file or

# read the smb.conf manpage.

# Run ‘testparm’ to verify the config is correct after

# you modified it.

[global]

workgroup = WORKGROUP

security = user

map to guest = Bad User

server string = Ted Samba Server %v

netbios name = TC

passdb backend = tdbsam

printing = cups

printcap name = cups

load printers = yes

cups options = raw

[share]

comment = Share Directories

path = /home/share

public = yes

writable = yes

create mask = 0775

directory mask = 0775

[homes]

comment = Home Directories

valid users = %S, %D%w%S

browseable = No

read only = No

#是否能够写入

writable = yes

#树立文件后文件的权能

create mode = 0664

#创建目录的后目录的权杖

directory mode =

[printers]

comment = All Printers

path = /var/tmp

printable = Yes

create mask = 0600

browseable = No

[print$]

comment = Printer Drivers

path = /var/lib/samba/drivers

write list = @printadmin root

force group = @printadmin

create mask = 0664

directory mask = 0775

[root@hejie ~]# vim /etc/samba/smb.conf
[global]
        workgroup = SAMBA
        security = user
        map to guest = Bad User  //增多此行

注释:

2.创办分享目录

workgroup 项应与 Windows 主机保持后生可畏致,这里是WO悍马H2KGROUP

[root@hejie ~]# mkdir /opt/ranran
[root@hejie ~]# chmod 777 /opt/ranran/
[root@hejie ~]# ll /opt/ranran/ -d
drwxrwxrwx. 2 root root 6 Aug 7 19:24 /opt/ranran/

security、map to guest项设置为允许佚名顾客访谈

3.配备分享

再上面有五个section,实际为多少个目录,section名正是目录名(映射到Windows上得以见到)

[root@hejie ~]# cat >> /etc/samba/smb.conf <<EOF
> [ran]
> comment = ranranwoaini
> path = /opt/ranran
> browseable = yes
> writable = yes
> guest ok = yes
> public = yes
> EOF

私下认可文件属性644/755(不然的话,Windows上在此个目录下新建的文书会有“可进行”属性)

4.重启服务

创建客户组:

[root@hejie ~]# systemctl restart smb

groupadd co3

5.在客商机上查看服务器端有怎么样分享能源

开创用户:

[root@hyj ~]# smbclient -L 192.168.56.11 -U ‘Bad User’
Enter SAMBA\Bad User’s password:    // 这里向来敲回车,不用输入密码
 Sharename Type Comment
 ——— —- ——-
 print$ Disk Printer Drivers
 zhengran Disk zhengranwoaini
 ran Disk ranranwoaini
 IPC$ IPC IPC Service (Samba 4.6.2)
Reconnecting with SMB1 for workgroup listing.

useradd jc -g co3 -s /sbin/nologin

 Server Comment
 ——— ——-

//增多客户时。实践本行命令。输入密码就能够

 Workgroup Master
 ——— ——-

增进顾客:

6.将samba服务器的分享财富ran挂在到客商机上

smbpasswd -a jc

[root@hyj ~]# mount -t cifs //192.168.56.11/ran /opt/ran -o
username=’Bad User’
Password for Bad User@//192.168.56.11/ran: 
[root@hyj ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 17G 1016M 16G 6% /
devtmpfs 982M 0 982M 0% /dev
tmpfs 993M 0 993M 0% /dev/shm
tmpfs 993M 8.5M 984M 1% /run
tmpfs 993M 0 993M 0% /sys/fs/cgroup
/dev/sda1 1014M 125M 890M 13% /boot
tmpfs 199M 0 199M 0% /run/user/0
//192.168.56.11/ran 47G 5.4G 42G 12% /opt/ran

授权客户:

7.在客商机上步入分享目录创建新文件

smbpasswd -e jc

[root@hyj ~]# cd /opt/ran/
[root@hyj ran]# ls
[root@hyj ran]# touch a b c
[root@hyj ran]# ls
a b c

开发银行Samba服务,设置开机运行

8.在服务端验证

systemctl start smb

systemctl enable smb

[root@hejie ~]# cd /opt/ranran/
[root@hejie ranran]# ls
a b c

查看Samba

更加多萨姆ba相关学科见以下内容:

# systemctl start smb nmb ##注:NMB对顾客端提供NetBIOS服务

# systemctl status smb nmb

CentOS 7.2 安装配备Samba服务器 

VMWare 虚拟机 Ubuntu
双网卡 访问 samba 速度 翻倍

samba安装使用图解 
CentOS7.2下源码搭建Samba文件服务器[原创]

何以在Ubuntu 16.04上设置和配置Samba服务器以开展文件共享 

CentOS 7下Samba服务安装与布局详解

Red Hat 6.5 下
Samba服务器搭建
如何在Ubuntu 17.10上使用System-Config-Samba 

重启防火墙

Linux公社的RSS地址:

systemctl restart firewalld

正文长久更新链接地址

本机测量检验:

美高梅开户网址 7

testparm

仿效文献

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图