Skip to content

Simple Docker image for publically sharing a folder using the SMB protocol.

License

Notifications You must be signed in to change notification settings

recolic/docker-samba-publicshare

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Samba Folder Sharing

This image allows you to easily share a folder to the public using the SMB protocol, similar to what python3 -m http.server offers for HTTP.

Usage

To share a folder, bind it as a volume to the internal path /srv and expose the ports required by the SMB protocol. An example would be

docker run -td \
	--publish 445:445 \
	--publish 137:137 \
	--publish 138:138 \
	--publish 139:139 \
	--volume /srv/samba:/srv \
	jenserat/samba-publicshare

Note: observe the -t parameter, which attaches a pseudo-tty. This was not required on earlier releases of smbd. Without attaching a tty, smbd will exit immediately after starting up. If you use a docker-compose setup, you should add tty: true to your docker-compose.yml

Use the optional workgroup environment variable to set the workgroup:

	--env workgroup=myworkgroup

The repository contains a wrapper script to easen up sharing folders, automatically exposing the ports as needed. Pass the path as first parameter (otherwise the working directory is shared), and optionally the work group as second parameter.

samba-publicshare [path [workgroup]]

To share /tmp with the default workgroup name, run samba-publicshare /tmp. To share the working directory, run samba-publicshare without any parameters.

Read-only Volumes

By mounting a volume read-only, the share will be read-only, but simply because of Samba not being able to write to the directory and thus returning an access denied error message, not by passing correct read-only permissions to the client.

Stopping Samba

I didn't figure out a way yet to terminate Samba in foreground mode by pressing keys. Use docker stop [name] instead.

Caveats

No access restrictions are applied, the shared folder is publically readable and writable! Reconsider usage in public networks.

About

Simple Docker image for publically sharing a folder using the SMB protocol.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 68.2%
  • Shell 31.8%