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
|
|
|
|
|
|
|
|
```
|
|
|
|
samba:
|
|
|
|
image: vimagick/samba
|
|
|
|
ports:
|
|
|
|
- "137:137/udp"
|
|
|
|
- "138:138/udp"
|
|
|
|
- "139:139/tcp"
|
|
|
|
- "445:445/tcp"
|
|
|
|
volumes:
|
2016-03-06 11:37:18 +02:00
|
|
|
- ./smb.conf:/etc/samba/smb.conf
|
|
|
|
- ./share:/share
|
2015-07-17 17:11:33 +02:00
|
|
|
restart: always
|
|
|
|
```
|
|
|
|
|
|
|
|
## smb.conf
|
|
|
|
|
|
|
|
```
|
|
|
|
[global]
|
|
|
|
workgroup = WORKGROUP
|
2016-04-07 02:35:31 +02:00
|
|
|
netbios name = EasyPi
|
|
|
|
server string = Samba Server
|
2016-03-06 11:37:18 +02:00
|
|
|
map to guest = bad user
|
2015-07-17 17:11:33 +02:00
|
|
|
|
|
|
|
[share]
|
|
|
|
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
|
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-03-06 11:37:18 +02:00
|
|
|
$ smbutil view -NG smb://server
|
|
|
|
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
|
|
|
|
$ mount_smbfs //guest@server/share /Volumes/share
|
|
|
|
$ 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/
|