samba 使用
在系统开发过程中,因为做了负载均衡,文件无法保存在程序的单节点中,需要使用使用独立的文件服务进行管理,调研了几个软件,samba比较适合我们的需求。
一、安装
全安装
sudo dnf install samba samba-common samba-client
客户端安装
yum install -y samba-client
查看版本号
smbd -V
编辑配置文件
vim /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = centos-8
security = user
map to guest = bad user
dns proxy = no
[public]
path = /share
browsable =yes
writable = yes
guest ok = yes
read only = no
运行测试命令
testparm
启动samba
sudo systemctl start smb
sudo systemctl enable smb
systemctl restart smb
systemctl status smb
二、客户端连接
从客户端连接到 samba
smbclient //192.168.0.120/public -U root
ls //查看文件
get xxx.xxx //下载文件
put xxx.xxx //上传文件
挂载目录,在指定服务器上执行
mount -t cifs //192.168.0.120/public /share -o username=root,password=xxxxxx
umount /share
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 一文读懂知识蒸馏
· 终于写完轮子一部分:tcp代理 了,记录一下
2018-05-27 C#集合-列举(Enumeration)