在实际开发中,我们经常会有跨系统之间文件传递的需求,Samba便是能够在Windows和Linux之间传递文件的服务,功能也是非常强大和好用,本篇文章将介绍如何在Linux系统上安装Samba服务,以CentOS7系统为例。
一、yum安装Samba
yum -y install samba samba-client #使用yum安装samba
二、创建Samba用户
useradd share #创建用户share
smbpasswd -a share #为新用户share设置密码
三、创建共享目录
su share #切换用户为我们刚刚创建的share用户
mkdir share #创建共享文件夹share
chmod 777 share #为共享文件夹设置全权限
四、修改配置文件
cp /etc/samba/smb.conf /etc/samba/smb.conf.back #备份samba的配置文件
vi /etc/samba/smb.conf #使用vi编辑器配置文件
在配置文件末尾添加:
[share]
path = /share //这里填写共享文件夹的地址
available = yes
browseable = yes
public = yes
writable = yes
五、启动服务
systemctl start nmb #启动nmb服务
systemctl start smb #启动smb服务
systemctl enable smb.service #设置smb服务为自启动
systemctl status smb.service #查看smb服务的开启状态
Damon, Chinese, Liu Guangzhi, Software development engineer, CSDN quality creator, Ali Cloud expert blogger, Microsoft Technology Associate, Good at C#, Java, PHP, Python, etc, Love sports, Workaholic, Communist.
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有