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)

相关推荐
LN花开富贵19 小时前
Ubuntu aarch64 架构安装 NoMachine 远程控制 避坑与实战
linux·运维·笔记·学习·ubuntu·嵌入式
取经蜗牛19 小时前
Windows 11 WSL + Ubuntu 24.04 安装指南
linux·windows·ubuntu
bush41 天前
linux开发板连接virtualbox虚拟机ubuntu的usb网卡,访问外网方法。
linux·运维·ubuntu
大明者省1 天前
完整 Ubuntu 服务器 XFCE 桌面 + XRDP 远程桌面 部署使用全流程
运维·服务器·ubuntu
Irene19911 天前
在 WSL Ubuntu 上安装和使用 Hive
linux·hive·ubuntu
ZGUIZ1 天前
Ubuntu 25.10 蓝牙Wifi不可用解决流程
linux·运维·ubuntu
Irene19911 天前
Windows 11 WSL Ubuntu 环境:安装 Hadoop 完整指南
hadoop·ubuntu
勤自省1 天前
ROS2 + OpenCV 实战教程:人脸识别、物体跟踪、ArUco 二维码识别初级
人工智能·opencv·ubuntu·计算机视觉·ros2
野熊佩骑2 天前
一文读懂Nginx 之 Ubuntu使用apt方式安装Nginx官方最新版本
linux·运维·服务器·nginx·ubuntu·http