centos7安装配置samba

1、安装samba

执行yum -y install samba

2、配置samba

mkdir -p samba/share     创建共享目录

chmod 777 /samba/share/   设置目录权限,否则windows下访问不能修改

修改samba配置文件:

cd /etc/samba/        定位到配置文件目录

cp smb.conf smb.conf.bak   备份配置文件

vim smb.conf     编辑配置文件

[global]
    workgroup = WORKGROUP
    security = user
    map to guest = Bad User

    passdb backend = tdbsam

    printing = cups
    printcap name = cups
    load printers = yes
    cups options = raw

# 设置默认用户和用户组,不是root用户登录时有用,该配置在ubuntu18.04上验证过
#    force user = xxx
#    force group = xxx

#[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 = share file
    path = /samba/share
    writable = yes
    browseable = yes
    guest ok = yes
    create mask = 0644    //创建文件属性
    force user = root    //和服务端用户一样

systemctl disable firewalld   禁用防火墙

vim /etc/selinux/config   修改"SELINUX=enforcing"为"SELINUX=disabled"

systemctl enable smb  自动启动smb服务

reboot   重启

3、访问共享目录

centos7安装配置samba_第1张图片

你可能感兴趣的:(linux,centos7,samba,共享)