centos7 设置samba服务

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36492368/article/details/80800789

samba主要是用于在windos映射到linux。开发中这样做非常方便。

安装:yum -y install samba 

备份配置文件:cp /etc/samba/smb.conf  /etc/samba/smb.conf_bk

修改配置:

具体配置文件解释,可以百度。

vi /etc/samba/smb.conf

[global]
        workgroup = SAMBA
        security = user
        passdb backend = tdbsam
        printing = cups
        printcap name = cups
        load printers = yes
        cups options = raw
[root]
        comment = root file
        path = /root
        writeable=yes
        guest ok = yes
        create mask = 0644
        directory mode=0775
        valid users=root
        browseable = yes
        display charset=UTF-8

        unix charset=UTF-8

        dos charset=UTF-8

保存::wq

配置文件简介:

映射的是root目录。允许写操作。创建的文件夹默认644权限,文件默认775权限。使用root用户登录。

samba使用的是tdbsam模式。所以只能使用linux 中存在的用户。这里我使用的是root 用户

设置用户密码:

smbpasswd -a root

防火墙设置:

firewall-cmd --permanent --zone=public --add-service=samba

firewall-cmd --reload

关闭Selinux:

setenforce 0

vi /etc/selinux/config

SELINUX=enforcing改为SELINUX=disabled,保存后退出

设置smb自启动:

vi /etc/re.d/rc.local

在最后添加

/bin/systemctl start smb.service



猜你喜欢

转载自blog.csdn.net/qq_36492368/article/details/80800789