2015-07-17 16:53:21 +02:00
|
|
|
samba
|
|
|
|
=====
|
|
|
|
|
2015-07-17 17:11:33 +02:00
|
|
|
![](https://badge.imagelayers.io/vimagick/samba:latest.svg)
|
|
|
|
|
2016-03-06 11:37:18 +02:00
|
|
|
[Samba][1] is the standard Windows interoperability suite of programs for
|
2015-07-17 17:11:33 +02:00
|
|
|
Linux and Unix.
|
|
|
|
|
|
|
|
## docker-compose.yml
|
|
|
|
|
2017-05-01 08:14:27 +02:00
|
|
|
```yaml
|
2015-07-17 17:11:33 +02:00
|
|
|
samba:
|
|
|
|
image: vimagick/samba
|
|
|
|
volumes:
|
2017-05-01 08:14:27 +02:00
|
|
|
- ./data/smb.conf:/etc/samba/smb.conf
|
|
|
|
- ./share:/share
|
2016-04-07 03:46:55 +02:00
|
|
|
net: host
|
2016-05-06 14:48:37 +02:00
|
|
|
tty: yes
|
2015-07-17 17:11:33 +02:00
|
|
|
restart: always
|
|
|
|
```
|
|
|
|
|
2016-07-03 16:48:47 +02:00
|
|
|
> Uncomment to use a customized config file.
|
|
|
|
|
2016-04-24 03:49:31 +02:00
|
|
|
## mnt-usb.mount
|
|
|
|
|
|
|
|
An USB flash drive is mounted at `/mnt/usb`.
|
|
|
|
|
|
|
|
```
|
|
|
|
# /etc/systemd/system/mnt-usb.mount
|
|
|
|
[Unit]
|
|
|
|
Description=USB Storage Mount
|
|
|
|
|
|
|
|
[Mount]
|
|
|
|
What=/dev/disk/by-uuid/829B-2038
|
|
|
|
Where=/mnt/usb
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=local-fs.target
|
|
|
|
```
|
2016-04-12 12:28:27 +02:00
|
|
|
|
2015-07-17 17:11:33 +02:00
|
|
|
## smb.conf
|
|
|
|
|
|
|
|
```
|
|
|
|
[global]
|
2016-04-12 12:28:27 +02:00
|
|
|
netbios name = easypi
|
2015-07-17 17:11:33 +02:00
|
|
|
workgroup = WORKGROUP
|
2016-04-12 12:28:27 +02:00
|
|
|
server string = EasyPi Samba Server
|
2016-04-11 14:27:12 +02:00
|
|
|
server role = standalone
|
2016-03-06 11:37:18 +02:00
|
|
|
map to guest = bad user
|
2016-04-11 14:27:12 +02:00
|
|
|
usershare allow guests = yes
|
|
|
|
|
|
|
|
[homes]
|
|
|
|
comment = Home Directories
|
|
|
|
browseable = no
|
|
|
|
writable = yes
|
2015-07-17 17:11:33 +02:00
|
|
|
|
|
|
|
[share]
|
2016-04-11 14:27:12 +02:00
|
|
|
comment = Public File Sharing
|
2015-07-17 17:11:33 +02:00
|
|
|
path = /share
|
|
|
|
browseable = yes
|
2016-04-07 02:56:01 +02:00
|
|
|
read only = no
|
2015-07-17 17:11:33 +02:00
|
|
|
guest ok = yes
|
2016-04-07 02:56:01 +02:00
|
|
|
admin users = root
|
2015-07-17 17:11:33 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## server
|
|
|
|
|
|
|
|
```
|
|
|
|
$ cd ~/fig/samba
|
2015-07-17 17:50:28 +02:00
|
|
|
$ mkdir share
|
|
|
|
$ touch share/README.txt
|
2015-07-17 17:11:33 +02:00
|
|
|
$ docker-compose up -d
|
|
|
|
$ docker exec -it samba_samba_1 sh
|
2016-04-24 03:49:31 +02:00
|
|
|
>>> testparm
|
2015-07-17 17:50:28 +02:00
|
|
|
>>> smbpasswd -a root
|
|
|
|
New SMB password:******
|
|
|
|
Retype new SMB password:******
|
2015-07-17 17:11:33 +02:00
|
|
|
>>> exit
|
|
|
|
```
|
|
|
|
|
|
|
|
## client
|
|
|
|
|
|
|
|
```
|
2016-04-07 03:46:55 +02:00
|
|
|
$ smbutil view -NG smb://easypi
|
2016-03-06 11:37:18 +02:00
|
|
|
Share Type Comments
|
|
|
|
-------------------------------
|
|
|
|
share Disk
|
2016-04-07 02:56:01 +02:00
|
|
|
IPC$ Pipe IPC Service (Samba Server)
|
2016-03-06 11:37:18 +02:00
|
|
|
2 shares listed
|
|
|
|
|
|
|
|
$ mkdir -p /Volumes/share
|
2016-04-07 03:46:55 +02:00
|
|
|
$ mount_smbfs //guest@easypi/share /Volumes/share
|
2016-03-06 11:37:18 +02:00
|
|
|
$ umount /Volumes/share
|
2015-07-17 17:11:33 +02:00
|
|
|
```
|
2015-07-17 16:53:21 +02:00
|
|
|
|
2016-04-07 02:56:01 +02:00
|
|
|
> `root` user can read and write, `guest` user can read only.
|
|
|
|
|
2015-07-17 16:53:21 +02:00
|
|
|
[1]: https://www.samba.org/
|