Docker镜像搭建Linux下samba共享目录

Samba 是 SMB/CIFS 网络协议的重新实现, 它作为 NFS 的补充使得在 Linux、OS/2、DOS 和 Windows 系统中进行文件共享、打印机共享更容易实现。SMB协议是客户机/服务器型协议,客户机通过该协议可以访问服务器上的共享文件系统、打印机及其他资源。通过设置“NetBIOS over TCP/IP”使得Samba不但能与局域网络主机分享资源,还能与全世界的电脑分享资源。
这里通过使用docker镜像的方式来简化samba的安装, 来实现不同系统之间共享目录。
运行docker
sudo docker run -it -p 139:139 -p 445:445 -d dperson/samba
如果要使用本地存储,则可以:
sudo docker run -it --name samba -p 139:139 -p 445:445 \
-v /path/to/directory:/mount \
-d dperson/samba
配置参数:
docker run -it --rm dperson/samba -h
Usage: samba.sh [-opt] [command]
Options (fields in '[]' are optional, '<>' are required):
-h This help
-c "<from:to>" setup character mapping for file/directory names
required arg: "<from:to>" character mappings separated by ','
-g "<parameter>" Provide global option for smb.conf
required arg: "<parameter>" - IE: -g "log level = 2"
-i "<path>" Import smbpassword
required arg: "<path>" - full file path in container
-n Start the 'nmbd' daemon to advertise the shares
-p Set ownership and permissions on the shares
-r Disable recycle bin for shares
-S Disable SMB2 minimum version
-s "<name;/path>[;browse;readonly;guest;users;admins;writelist;comment]"
Configure a share
required arg: "<name>;</path>"
<name> is how it's called for clients
<path> path to share
NOTE: for the default value, just leave blank
[browsable] default:'yes' or 'no'
[readonly] default:'yes' or 'no'
[guest] allowed default:'yes' or 'no'
[users] allowed default:'all' or list of allowed users
[admins] allowed default:'none' or list of admin users
[writelist] list of users that can write to a RO share
[comment] description of share
-u "<username;password>[;ID;group]" Add a user
required arg: "<username>;<passwd>"
<username> for user
<password> for user
[ID] for user
[group] for user
-w "<workgroup>" Configure the workgroup (domain) samba should use
required arg: "<workgroup>"
<workgroup> for samba
-W Allow access wide symbolic links
-I Add an include option at the end of the smb.conf
required arg: "<include file path>"
<include file path> in the container, e.g. a bind mount
The 'command' (if provided and valid) will be run instead of samba
示例
现在要将目录xw_share, 通过139和445端口进行共享, 并创建用户xw(密码为:overkill),禁用匿名用户访问,并且允许用户xw读写操作,可以如下设置:
docker run -it --name samba -p 139:139 -p 445:445 \
-v $PWD/nl_share:/mount -d dperson/samba -u "xw;overkill" -s "xw;/mount/;yes;no;no;all;xw;xw"
参考:
- Samba (简体中文)
- samba百度百科
- https://github.com/dperson/samba
- xwxwgo
Docker镜像搭建Linux下samba共享目录的更多相关文章
- Docker镜像搭建ubuntu下samba目录共享
第一种方法:(未使用) yum install docker // 下载镜像 docker pull dperson/samba // 启动镜像,具体看文档,但重要的配置是以下的注释 docker r ...
- windows怎么访问linux的samba共享目录
windows怎么访问linux的samba共享目录 听语音 原创 | 浏览:6976 | 更新:2018-07-31 13:20 | 标签:LINUX WINDOWS 1 2 3 4 5 6 7 分 ...
- Linux下设置共享目录
Linux系统的文件或目录的共享功能是非常强大,而且是非常灵活的,其对权限的控制可以做到非常的细致,当然如果你是通过命令行方式进行设置的 话,那么对于刚接触linux系统的用户来说将是一件十分头痛的事 ...
- Windows访问Linux下的共享目录的配置方法
user安全级别 第一步:安装samba3(如果已经安装就跳过这一步) [root@rhce2 /]# yum groupinstall "CIFS file server" 第 ...
- linux下nfs共享目录
1. 关掉防火墙 systemctl disable firewalld.service 2. 关掉selinux vim /etc/selinux/config 修改第七行: ...
- virtualBox下面安装linux系统如何共享目录
背景: 系统是win+virtualBox 在虚拟机中安装了linuxMint系统. 如何共享目录呢 第一步: 在虚拟机中安装增强功能 2,在virtualBox中设置共享目录 3,在linux下创建 ...
- 将samba共享目录映射为本地文件夹(百度网盘直接下载到samba共享目录下)
将samba共享目录映射为本地文件夹(百度网盘直接下载到samba共享目录下) 前面淘了一个蜗牛星际的矿机,打算拿来做个个人云盘,就装上了Linux用smb把硬盘共享出来 访问倒是很爽,就是发现下东西 ...
- Linux编译Windows共享目录下代码
Linux编译Windows共享目录下代码(金庆的专栏)万神服务器代码是跨平台的.平时策划在Windows上开自己的服务器测试,测试和发布服务器为Linux.开发时,先在Windows上编译测试,再到 ...
- linux下scsi共享磁盘的简单搭建
linux下scsi共享磁盘的简单搭建 Scsi 共享磁盘需要我先有空余的分区,或者可以在虚拟机里面添加一块磁盘,安装所需的软件我在虚拟机里面添加了一块硬盘,分了一个主分区,sdb1 1G,将这个用s ...
随机推荐
- 构造用于1个方法在多线程环境下重复多次执行测试的通用方法 C#
static void MultithreadsCycleTestWithSameMethod(int threadNumber, int cycleNumber, ThreadStart actio ...
- php判断是否isPhone、is_weixin
protected function isPhone(){ $agent = strtolower($_SERVER['HTTP_USER_AGENT']); //pc请求头信息数组 $pc_arr= ...
- python学习之老男孩python全栈第九期_数据库day003 -- 作业
数据库: class: course: student: teacher: score: /* Navicat Premium Data Transfer Source Server : local ...
- CSS 画一个八卦
效果图: 实现原理: 设置高度为宽度的2倍的一个框,利用 border 补全另一半的宽度,设置圆角 用两个 div 设置不同的颜色,定位到圆的上下指定位置. 最后只剩下里面的小圆圈了.设个宽高,圆角即 ...
- 报错”Cannot read property 'addEventListener' of null“
1.报错:Cannot read property 'addEventListener' of null 2.解决方案: 把代码放到window.onload=function(){...}里面,因为 ...
- 润乾报表html代码填报
由于html和富文本类型的单元格,不能进行可写操作,如果要想填报时填入html代码并且提交后更新就要换了一个方法,通过数据回填的方法. 比如在C3单元格设置html事件(也可以通过一个按钮来触发 ...
- java boolean 值在内存中占几位?
java boolean 值在内存中占几位? <Java虚拟机规范>中这样描述:虽然定义了boolean这种数据类型,但是只对它提供了非常有限的支持.在Java虚拟机中没有任何供 ...
- 关于Redo Log的基本操作
1.创建新的日志组 alter database add logfile group 4 ('/u01/oracle/product/10.0.2/oradata/ORCL/redo41.log') ...
- 单机安装hive和presto
问题: 公司最近在搞presto,主要是分析一下presto和hive的查询大数据量的性能对比: 我先把我的对比图拿出来(50条数据左右)针对同一条sql(select * from employee ...
- Oracle EBS 解决OAF黑屏,卡顿,反应慢