layui做网站,高端大气网站源码,福建省网站备案注销,库房管理软件本实验将使用华为云云耀云服务器L实例#xff0c;使用CentOS 7.9系统#xff0c;搭建部署Samba服务器#xff0c;并在本地Windows端进行访问。 文章目录 1、samba介绍2、环境准备3、安装samba软件包4、修改smb.conf配置文件5、添加访问samba的用户6、Windows下访问Samba服务…
本实验将使用华为云云耀云服务器L实例使用CentOS 7.9系统搭建部署Samba服务器并在本地Windows端进行访问。 文章目录 1、samba介绍2、环境准备3、安装samba软件包4、修改smb.conf配置文件5、添加访问samba的用户6、Windows下访问Samba服务器7、映射网络驱动器8、常见问题9、参考链接 1、samba介绍
Samba网盘Samba是一个网络服务器用于Linux和Windows之间共享文件Samba一般装在Linux系统中作为服务器为Windows用户提供网盘。
2、环境准备
购买一台云耀云服务器L实例本实验采用的是CentOS 7.9系统 关闭防火墙
[roothcss-ecs-2d95 ~]# systemctl stop firewalld
[roothcss-ecs-2d95 ~]# systemctl disable firewalld
[roothcss-ecs-2d95 ~]# systemctl status firewalld关闭SELinux安全模式
## 临时关闭
[roothcss-ecs-2d95 ~]# setenforce 0## 永久关闭
[roothcss-ecs-2d95 ~]# vim /etc/selinux/config
修改SELINUXdisabled
按:wq保存退出重启系统即可[roothcss-ecs-2d95 ~]# getenforce
Disabled云服务器安全组端口放行设置本实验为实验环境所有放行了所有端口和协议具体实际使用场景中根据需要进行端口设置。 3、安装samba软件包
安装samba软件包
## 加载系统镜像
# yum repolist## 使用YUM源安装samba软件包
# yum install -y samba## 查看安装的samba服务是否完成
# rpm -qa | grep samba
samba-libs-4.10.16-24.el7_9.x86_64
samba-common-libs-4.10.16-24.el7_9.x86_64
samba-common-tools-4.10.16-24.el7_9.x86_64
samba-common-4.10.16-24.el7_9.noarch
samba-client-libs-4.10.16-24.el7_9.x86_64
samba-4.10.16-24.el7_9.x86_64启动samba服务并设置开机自启动
[roothcss-ecs-2d95 ~]# systemctl start smb
[roothcss-ecs-2d95 ~]# systemctl enable smb
[roothcss-ecs-2d95 ~]# systemctl status smb# 查看smb服务是否设置开机自启动状态
[roothcss-ecs-2d95 ~]# systemctl list-unit-files | grep smb
smb.service enabled4、修改smb.conf配置文件
创建需要共享的目录及文件
# mkdir /mnt/public
# touch /mnt/public/test01.txt /mnt/public/test02.txt# vim /mnt/xyb_share/helloworld.txt
# cat /mnt/xyb_share/helloworld.txt
hello world!xybdiy xybdiy xybdiy修改smb.conf配置文件
## 备份smb.conf配置文件
# cp /etc/samba/smb.conf /etc/samba/smb.conf.bak## 修改smb.conf配置文件
[roothcss-ecs-2d95 ~]# vim /etc/samba/smb.conf
[roothcss-ecs-2d95 ~]# cat /etc/samba/smb.conf
# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run testparm to verify the config is correct after
# you modified it.[global]workgroup SAMBAsecurity userpassdb backend tdbsamprinting cupsprintcap name cupsload printers yescups options raw[homes]comment Home Directoriesvalid users %S, %D%w%Sbrowseable Noread only Noinherit acls Yes[printers]comment All Printerspath /var/tmpprintable Yescreate mask 0600browseable No[print$]comment Printer Driverspath /var/lib/samba/driverswrite list printadmin rootforce group printadmincreate mask 0664directory mask 0775
# 新增配置内容如下
[public]comment Publicpath /mnt/publicpublic yesbrowseable yesguest ok yes
[xyb_share]comment xyb_sharepath /mnt/xyb_sharepublic yesbrowseable yesguest ok yes重启samba服务
[roothcss-ecs-2d95 ~]# systemctl restart smb测试samba服务
[roothcss-ecs-2d95 ~]# testparm
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Server role: ROLE_STANDALONEPress enter to see a dump of your service definitions输出Loaded services file OK.即表示配置成功。 5、添加访问samba的用户
[roothcss-ecs-2d95 ~]# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.6、Windows下访问Samba服务器 按住winR打开运行窗口输入\\ IP地址\共享目录。如下图所示。 输入用户名和密码。 访问成功。 7、映射网络驱动器
选择映射网络驱动器 按照以下输入格式键入\\121.37.153.196\xyb_share 输入访问samba服务的用户名和密码。 点击进入即可访问。 8、常见问题
在Windows端访问samba服务报错或者超时需要检查本地端是否开启SMB服务如下图所示。 发现如下报错信息可以修改smb.conf配置文件进行消除。具体设置如下 syslog 0
syslog only Yes重启samba服务即可。
[roothcss-ecs-2d95 ~]# systemctl restart smb
[roothcss-ecs-2d95 ~]# systemctl status smb9、参考链接 https://developer.aliyun.com/article/509753 https://bbs.huaweicloud.com/blogs/408963 https://www.cnblogs.com/lemanlai/p/12267330.html https://mp.weixin.qq.com/s/lchaWRRMioA7oSQRLWbQ1A