ubuntu14.04搭建Samba服务器实现文件共享

一、安装 samba 的核心插件:

1、sudo apt-get install samba 如果安装遇到问题,使用sudo aptitude install samba

二、修改 cd /etc/samba 下的配置文件 smb.conf :

2、sudo vim /etc/samba/smb.conf

三、添加配置文件:

将:security=user 改为security=share

在smb.conf的最后添加

x210v3_bsp

comment=samba ##这个是说明,随意填

path=/root/x210v3_bsp ## 这个是要分享的路径

public=yes

create mask=0777

directory mask=0777

writable=yes

available=yes

##要能修改文件夹,要么就将/var/www/html权限设置为777,或者加上如下设置

forceuser=root

forcegroup=root

如果需要多个共享文件夹

添加多段

四、重启 samba 服务器:

/etc/init.d/smbd restart

五、查看ubuntu主机服务器的ip地址,在windows下输入"\\192.168.0.112",就可以访问了。

问题:

"net usershare"返回错误 255:net usershare add: cannot share path /home/jacky/skynet as we are restricted to only sharing directories we own.

Ask the administrator to add the line "usershare owner only = false"

to the global section of the smb.conf to allow this.

解决方案:

vim /etc/samba/smb.conf

在 usershare allow guests = yes 下面添加 usershare owner only = false

wq保存退出即可

最好是再次重启一下Samba:"/etc/init.d/smbd restart"

在windows下删除文件或者文件夹,samba服务器备份删除的文件:

1、修改 cd /etc/samba 下的配置文件 smb.conf

sudo vim /etc/samba/smb.conf

2、在smb.conf中添加:

#以下参数用于配置回收站。

vfs object = recycle

recycle:repository = .deleted/%U

recycle:versions = Yes

recycle:keeptree = Yes

recycle:maxsixe = 0

recycle:exclude = .tmp|.mp3

recycle:noversions = *.doc

3、重启samba服务器:

/etc/init.d/smbd restart

这样在共享文件夹根目录下(例如:我创建的是/work有了一个隐藏的文件夹.deleted)

相关推荐
敲代码还房贷6 小时前
解决win7装不了vmware tools问题
ubuntu
下午写HelloWorld8 小时前
Linux系统及Ubuntu常用指令
linux·ubuntu·操作系统
哆啦A梦——14 小时前
Ubuntu 虚拟机 Docker 与 MySQL 8.0.42 部署指南
mysql·ubuntu·docker
上天_去_做颗惺星 EVE_BLUE14 小时前
【新 Linux 服务器上手全攻略】系统巡检、存储规划与开发环境初始化
linux·运维·服务器·ubuntu·macos·centos
das2m15 小时前
WSL2 Ubuntu 配置完美版 docker compose 指南
linux·ubuntu·docker
MIXLLRED15 小时前
Ubuntu 22.04 + ROS2 Humble 上部署 ScaRF‑SLAM指南
ubuntu·slam·ros2·离线建图
FlyWIHTSKY16 小时前
JavaScript 和 TypeScript 分别是什么,可以相互写吗
javascript·ubuntu·typescript
iRayCheung16 小时前
virtualbox安装的ubuntu系统跑numpy报错
linux·ubuntu·numpy
丑过三八线17 小时前
Systemd Cgroup 驱动详解
linux·ubuntu·容器
指尖在键盘上舞动18 小时前
RKNN 模型部署:onnx转rknn后精度下降 —— 精度调优与问题排查
python·ubuntu·rk3588·rknn·onnx·npu