centos

Centos7 -samba服务配置

2016-10-12  本文已影响377人  幽谷听泉
1.安装
$ sudo yum install samba samba-client -y
2.设置开机自动启动
$ sudo systemctl enable smb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/smb.service to /usr/lib/systemd/system/smb.service.
3.启动samba服务
$ sudo systemctl start smb.service
4.查看samba服务的状态
$ sudo systemctl status smb.service
 smb.service - Samba SMB Daemon
 Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disabled)
 Active: active (running) since Thu 2016-09-29 19:59:07 CST; 52s ago
 Main PID: 4816 (smbd)
...
5.配置配置文件
$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak  //备份配置文件
$ sudo  >smb.conf  //清空配置文件
$ sudo vim smb.conf 
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ==============================   
[django_project]
path = /home/caideyang/Documents/project  //分享的目录
browsable =yes
writable = yes
guest ok = yes
read only = no
public = no
vaild users = caideyang  //客户端登陆用户
6.创建samba用户
$ sudo smbpasswd -a caideyang
7.创建需分享的目录路径
$ mkdir -p  /home/caideyang/Documents/project 
8.重启samba服务

systemctl enable smb.service
systemctl enable nmb.service
systemctl restart smb.service
systemctl restart nmb.service

9.添加防火墙规则
$ sudo firewall-cmd --permanent --zone=public --add-service=samba
$ sudo firewall-cmd --reload
10.客户端访问
Paste_Image.png
上一篇下一篇

猜你喜欢

热点阅读