Samba的使用教程

博观而约取,厚积而薄发。这篇文章主要讲述Samba的使用教程相关的知识,希望能为你提供帮助。
1.安装samba

yum install -y samba
systemctl start smb#启动samba
systemctl restart smb#在修该过相应的配置文件之后需要重启该服务
systemctl stop smb#关闭samba
systemctl enable smb#设置 开机自动运行
cat /etc/resolv.conf#查看DNS
vi /etc/resolv.conf#配置DNS
nameserver 225.5.5.5#DNS

2.直接复制以下内容(#文件传输命令  yum   -y   install lrzsz  ,rz -y直接上传)
[global]#全局配置
workgroup = WORKGROUP#在windows显示的工作组
server string = SambaServer %v
netbios name = office#在windows显示的计算机名称
security = user
map to guest = bad user
dns proxy = no
server string = 文件共享服务器

[app端]
comment = app端
path = /data/samba/app端
valid users = test1
read only = No
security = share
directory mode =0777
force directory mode = 0777
[后端]
comment = 后端
path = /data/samba/后端
valid users = test2
read only = No
security = share
directory mode =0777
force directory mode = 0777
[公共]
comment = 公共
path = /data/samba/公共
valid users = test1,test2
read only = No
security = share
create mode = 0777
forcecreatemode = 0777
directory mode =0777
force directory mode = 0777

3.注释
path设定共享文件的路径
writable = ok是否可写
security = share验证与登陆方式(user是用户登陆,share默认公开)
browsable =yes是否可浏览
read only = No是否有写权限 no 代表有写权限
public = yes是否公开

4.新增用户(test1为用户1,test2为用户2)
[root@localhost ~]# useraddtest1
[root@localhost ~]# useraddtest2

5.设置密码
[root@localhost ~]# smbpasswd -atest1
New SMB password:
Retype new SMB password:
Added user test1.
[root@localhost ~]# smbpasswd -atest2
New SMB password:
Retype new SMB password:
Added user test2.

6.分配权限
cat /etc/samba/smb.conf#配置目录
cp smb.conf /etc/samba/#备份
chmod -R 777 *#所有人可读写的权限

【Samba的使用教程】7.到这一步就可以在windows访问samba了

    推荐阅读