{"id":21925100,"url":"https://github.com/fourstepper/docker-samba","last_synced_at":"2026-05-01T21:35:26.578Z","repository":{"id":208115440,"uuid":"720832994","full_name":"fourstepper/docker-samba","owner":"fourstepper","description":null,"archived":false,"fork":false,"pushed_at":"2023-11-19T19:48:37.000Z","size":204,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T18:03:10.421Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fourstepper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-11-19T18:29:00.000Z","updated_at":"2023-11-19T18:29:27.000Z","dependencies_parsed_at":"2023-11-19T20:30:41.335Z","dependency_job_id":"7e0bbde8-aac6-4cb2-a31c-925de7752a78","html_url":"https://github.com/fourstepper/docker-samba","commit_stats":null,"previous_names":["fourstepper/docker-samba"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fourstepper/docker-samba","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fourstepper%2Fdocker-samba","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fourstepper%2Fdocker-samba/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fourstepper%2Fdocker-samba/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fourstepper%2Fdocker-samba/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fourstepper","download_url":"https://codeload.github.com/fourstepper/docker-samba/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fourstepper%2Fdocker-samba/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32513968,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T21:17:11.303Z","updated_at":"2026-05-01T21:35:26.552Z","avatar_url":"https://github.com/fourstepper.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![logo](https://github.com/fourstepper/docker-samba/blob/main/logo.jpg?raw=true)](https://www.samba.org)\n\n# Samba\n\n[![Create and publish the Docker image](https://github.com/fourstepper/docker-samba/actions/workflows/publish-image.yaml/badge.svg)](https://github.com/fourstepper/docker-samba/actions/workflows/publish-image.yaml)\n\nSamba docker container\n\n# What is Samba?\n\nSince 1992, Samba has provided secure, stable and fast file and print services\nfor all clients using the SMB/CIFS protocol, such as all versions of DOS and\nWindows, OS/2, Linux and many others.\n\n## Image versions\n\nI maintain three image versions of this image:\n\n- `ghcr.io/fourstepper/docker-samba` (basically, `ghcr.io/fourstepper/docker-samba:latest`)\n- `ghcr.io/fourstepper/docker-samba:\u003cstable_alpine_version\u003e` (for example `ghcr.io/fourstepper/docker-samba:3.18` as of November, 2023)\n- `ghcr.io/fourstepper/docker-samba:\u003coldstable_alpine_version\u003e` (for example `ghcr.io/fourstepper/docker-samba:3.17` as of November, 2023)\n\nIf you don't see the new version [in the packages](https://github.com/fourstepper/docker-samba/pkgs/container/docker-samba), don't hesitate to let me know in the [issues](https://github.com/fourstepper/docker-samba/issues).\n\n## How to use this image\n\nBy default there are no shares configured, additional ones can be added.\n\n## Hosting a Samba instance\n\n    sudo docker run -it -p 139:139 -p 445:445 -d ghcr.io/fourstepper/docker-samba -p\n\nOR set local storage:\n\n    sudo docker run -it --name samba -p 139:139 -p 445:445 \\\n                -v /path/to/directory:/mount \\\n                -d ghcr.io/fourstepper/docker-samba -p\n\n## Configuration\n\n    sudo docker run -it --rm ghcr.io/fourstepper/docker-samba -h\n    Usage: samba.sh [-opt] [command]\n    Options (fields in '[]' are optional, '\u003c\u003e' are required):\n        -h          This help\n        -c \"\u003cfrom:to\u003e\" setup character mapping for file/directory names\n                    required arg: \"\u003cfrom:to\u003e\" character mappings separated by ','\n        -G \"\u003csection;parameter\u003e\" Provide generic section option for smb.conf\n                    required arg: \"\u003csection\u003e\" - IE: \"share\"\n                    required arg: \"\u003cparameter\u003e\" - IE: \"log level = 2\"\n        -g \"\u003cparameter\u003e\" Provide global option for smb.conf\n                    required arg: \"\u003cparameter\u003e\" - IE: \"log level = 2\"\n        -i \"\u003cpath\u003e\" Import smbpassword\n                    required arg: \"\u003cpath\u003e\" - full file path in container\n        -n          Start the 'nmbd' daemon to advertise the shares\n        -p          Set ownership and permissions on the shares\n        -r          Disable recycle bin for shares\n        -S          Disable SMB2 minimum version\n        -s \"\u003cname;/path\u003e[;browse;readonly;guest;users;admins;writelist;comment]\"\n                    Configure a share\n                    required arg: \"\u003cname\u003e;\u003c/path\u003e\"\n                    \u003cname\u003e is how it's called for clients\n                    \u003cpath\u003e path to share\n                    NOTE: for the default values, just leave blank\n                    [browsable] default:'yes' or 'no'\n                    [readonly] default:'yes' or 'no'\n                    [guest] allowed default:'yes' or 'no'\n                    NOTE: for user lists below, usernames are separated by ','\n                    [users] allowed default:'all' or list of allowed users\n                    [admins] allowed default:'none' or list of admin users\n                    [writelist] list of users that can write to a RO share\n                    [comment] description of share\n        -u \"\u003cusername;password\u003e[;ID;group;GID]\"       Add a user\n                    required arg: \"\u003cusername\u003e;\u003cpasswd\u003e\"\n                    \u003cusername\u003e for user\n                    \u003cpassword\u003e for user\n                    [ID] for user\n                    [group] for user\n                    [GID] for group\n        -w \"\u003cworkgroup\u003e\"       Configure the workgroup (domain) samba should use\n                    required arg: \"\u003cworkgroup\u003e\"\n                    \u003cworkgroup\u003e for samba\n        -W          Allow access wide symbolic links\n        -I          Add an include option at the end of the smb.conf\n                    required arg: \"\u003cinclude file path\u003e\"\n                    \u003cinclude file path\u003e in the container, e.g. a bind mount\n\n    The 'command' (if provided and valid) will be run instead of samba\n\nENVIRONMENT VARIABLES\n\n- `CHARMAP` - As above, configure character mapping\n- `GENERIC` - As above, configure a generic section option (See NOTE3 below)\n- `GLOBAL` - As above, configure a global option (See NOTE3 below)\n- `IMPORT` - As above, import a smbpassword file\n- `NMBD` - As above, enable nmbd\n- `PERMISSIONS` - As above, set file permissions on all shares\n- `RECYCLE` - As above, disable recycle bin\n- `SHARE` - As above, setup a share (See NOTE3 below)\n- `SMB` - As above, disable SMB2 minimum version\n- `TZ` - Set a timezone, IE `EST5EDT`\n- `USER` - As above, setup a user (See NOTE3 below)\n- `WIDELINKS` - As above, allow access wide symbolic links\n- `WORKGROUP` - As above, set workgroup\n- `USERID` - Set the UID for the samba server's default user (smbuser)\n- `GROUPID` - Set the GID for the samba server's default user (smbuser)\n- `INCLUDE` - As above, add a smb.conf include\n\n**NOTE**: if you enable nmbd (via `-n` or the `NMBD` environment variable), you\nwill also want to expose port 137 and 138 with `-p 137:137/udp -p 138:138/udp`.\n\n**NOTE2**: there are reports that `-n` and `NMBD` only work if you have the\ncontainer configured to use the hosts network stack.\n\n**NOTE3**: optionally supports additional variables starting with the same name,\nIE `SHARE` also will work for `SHARE2`, `SHARE3`... `SHAREx`, etc.\n\n## Examples\n\nAny of the commands can be run at creation with `docker run` or later with\n`docker exec -it samba samba.sh` (as of version 1.3 of docker).\n\n### Setting the Timezone\n\n    sudo docker run -it -e TZ=EST5EDT -p 139:139 -p 445:445 -d ghcr.io/fourstepper/docker-samba -p\n\n### Start an instance creating users and shares:\n\n    sudo docker run -it -p 139:139 -p 445:445 -d ghcr.io/fourstepper/docker-samba -p \\\n                -u \"example1;badpass\" \\\n                -u \"example2;badpass\" \\\n                -s \"public;/share\" \\\n                -s \"users;/srv;no;no;no;example1,example2\" \\\n                -s \"example1 private share;/example1;no;no;no;example1\" \\\n                -s \"example2 private share;/example2;no;no;no;example2\"\n\n# User Feedback\n\n## Troubleshooting\n\n- You get the error `Access is denied` (or similar) on the client and/or see\n  `change_to_user_internal: chdir_current_service() failed!` in the container\n  logs.\n\nAdd the `-p` option to the end of your options to the container, or set the\n`PERMISSIONS` environment variable.\n\n    sudo docker run -it --name samba -p 139:139 -p 445:445 \\\n                -v /path/to/directory:/mount \\\n                -d ghcr.io/fourstepper/docker-samba -p\n\nIf changing the permissions of your files is not possible in your setup you\ncan instead set the environment variables `USERID` and `GROUPID` to the\nvalues of the owner of your files.\n\n- High memory usage by samba. Multiple people have reported high memory usage\n  that's never freed by the samba processes. Recommended work around below:\n\nAdd the `-m 512m` option to docker run command, or `mem_limit:` in\ndocker_compose.yml files, IE:\n\n    sudo docker run -it --name samba -m 512m -p 139:139 -p 445:445 \\\n                -v /path/to/directory:/mount \\\n                -d ghcr.io/fourstepper/docker-samba -p\n\n- Attempting to connect with the `smbclient` commandline tool. By default samba\n  still tries to use SMB1, which is depriciated and has security issues. This\n  container defaults to SMB2, which for no decernable reason even though it's\n  supported is disabled by default so run the command as `smbclient -m SMB3`, then\n  any other options you would specify.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffourstepper%2Fdocker-samba","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffourstepper%2Fdocker-samba","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffourstepper%2Fdocker-samba/lists"}