问题点说明

1. 防火墙问题

Smb服务会使用 139445 两个端口,院方可能需要开通访问策略

2. 系统配置问题

SELINUX=disable  

服务端安装说明:

1. 安装 rpm方式

安装文件

主文件

samba-4.10.16-24.el7_9.x86_64.rpm        

samba-libs-4.10.16-24.el7_9.x86_64.rpm

samba-common-4.10.16-24.el7_9.noarch.rpm

samba-common-tools-4.10.16-24.el7_9.x86_64.rpm

samba-common-libs-4.10.16-24.el7_9.x86_64.rpm

依赖文件

avahi-libs-0.6.31-20.el7.x86_64.rpm  

libtdb-1.3.18-1.el7.x86_64.rpm           

samba-client-libs-4.10.16-24.el7_9.x86_64.rpm

cups-libs-1.6.3-51.el7.x86_64.rpm    

libtevent-0.9.39-1.el7.x86_64.rpm        

gnutls-3.3.29-9.el7_6.x86_64.rpm     

libwbclient-4.10.16-24.el7_9.x86_64.rpm  

libldb-1.5.4-2.el7.x86_64.rpm        

nettle-2.7.1-8.el7.x86_64.rpm            

libtalloc-2.1.16-1.el7.x86_64.rpm    

 

命令 rpm -ivh --force --nodeps xxx.rpm  强制安装,忽略检查及依赖

 

2. 安装完成后

查看运行状态systemctl status smb

 

3. 创建共享目录

/home/share

 

4. 配置

/etc/samba/smb.conf

注调除global外的所有配置  

修改sercurityuser 验证使用

添加map to guest = bad user 禁止游客访问

添加share配置  如下

 

[global]

        workgroup = WORKGROUP

        security = user

        passdb backend = tdbsam

        map to guest = bad user        

        printing = cups

        printcap name = cups

        load printers = yes

        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 = @printadmin root

#       force group = @printadmin

#       create mask = 0664

#       directory mask = 0775

[share]

        comment = 上传文件

        path = /home/upload     # 共享文件位置

        valid users= @share  #归属用户

        writable = yes         #是否可写

        browseable = yes       #是否可见

        guest ok = no         #禁止游客访问

 

添加用户组share

groupadd share

添加组用户

Useradd -g share xxx

设置xxx密码

Passwd xxx

设置smb用户密码

Smbpasswd -a xxx

授权:

将文件归属赋值给share

Chown -R xxx:share /home/upload

目录授权:

Chmod -R 775

 

 

系统配置:

修改SELinux策略

/etc/selinux/config  配置文件

修改:SELINUX=disable

 

重启服务器后生效  或者 使用命令setenforce 0  (未测试)

注意:此时SELinux将被禁用,可能会影响系统安全性。

 

 

 

 



乐享:知识积累,快乐无限。