centos7 设置samba服务

xiaoxiao2021-02-28  19

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

转载请注明原文地址: https://www.6miu.com/read-1599988.html

最新回复(0)