samba
samba copied to clipboard
Yet another permission issue submission
I feel like I've scraped all the suggestions from the open/closed issues regarding lack of read/write permissions when accessing your samba share (in my case, and most other cases Windows 10)
I know the share is pointed properly as I can browse it's contents with guest mode turned on, but as soon as I turn guest mode off and try to configure the share for my user, I get an error saying the share is not accessible (I can see the share, can't view contents).
Here's my docker-compose.yml, it looks basically the same as everyone else's.
samba:
container_name: samba
image: dperson/samba
volumes:
- my-volume:/content:z
ports:
- "139:139"
- "445:445"
- "137:137/udp"
- "138:138/udp"
restart: unless-stopped
command: >
-u "user;pass;1000;user;1000"
-s "content;/content;yes;no;no;user"
-p
volumes:
my-volume:
I've tried these at the end of my command block: -g "force user =" -g "force group =" -p
I've tried these as environment variables: (the ids of my base image user running in ubuntu) SHARE: "content;/content;yes;no;no;user" USERID: 1000 GROUPID: 1000 PERMISSIONS:
I've tried with environment variables (SHARE, USER, USERID, GROUPID), or with the above command block. I open the container with bash and ls -l tells me that /content is owned by smbuser smb. Is user;pass;1000;user;1000 passed into smbuser and smb somehow? Shouldn't the share be owned by the user I defined?
Docker logs samba shows me the following: Added user user. smbd version 4.12.2 started. Copyright Andrew Tridgell and the Samba Team 1992-2020 daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
So it is successfully creating my user, but when I try to auth as said user in Windows to the SMB share, I get errored that the share is not accessible.
(Edit:) Figured I'd add more info as I have trouble sitting still: my-volume is owned by root root when inspecting it from the base os (ubuntu) my-volume is owned by smbuser smb when inspecting it from inside the samba container. I cannot connect to the samba share from another ubuntu server using smbclient, here's what I get:
root@other-host:~$ /usr/bin/smbclient -L local IP of samba server
WARNING: The "syslog" option is deprecated
Enter WORKGROUP\root's password: <I entered the password>
Sharename Type Comment
--------- ---- -------
wikicontent Disk
IPC$ IPC IPC Service (Samba Server)
Reconnecting with SMB1 for workgroup listing.
protocol negotiation failed: NT_STATUS_INVALID_NETWORK_RESPONSE
Failed to connect with SMB1 -- no workgroup available
root@other-host:~$
So I added the -w "WORKGROUP" command to the above docker-compose.yml's command block, but that didn't change anything when trying to connect from W10 or Ubuntu.
Hi guys, after many hours i resolve this issue with this config
version: '3.4'
services: samba: image: dperson/samba container_name: samba environment: - TZ=America/Santiago - USERID=0 - GROUPID=0 - WORKGROUP=Homeserver ports: - "137:137/udp" - "138:138/udp" - "139:139/tcp" - "445:445/tcp" tmpfs: - /tmp restart: unless-stopped stdin_open: true read_only: false tty: true volumes: - '/mnt/toshiba:/mnt:z' - '/mnt/toshiba/Claudia:/Clau:z' command: '-s "Toshiba;/mnt;yes;no;no;admin;''none'';''none'';''Homeserver''" -s "Clau;/Clau;yes;no;no;clau;''none'';''none'';''Homeserver''" -u "admin;password" -u "clau;1234"'
I hope this help you!
Permission management in this container are awfully complex...if you run this container with user: 1000:1000 I really struggle to see why it still exports a share where nothing is writeable!
Relying on a "-p" flag that then executes chown over the entire mounted volumes is really awful and then worse it seems by default to map to a user called apt and a group called systemd-journal.
FWIW this container worked instantlly for me, and easily mapped to a user on my server:
docker run -d -p 445:445 -e TZ=Europe/Madrid \
-v /opt:/opt elswork/samba \
-u "1000:1000:myusername:myusername:apassword" \
-s "SmbShare:/opt:rw:myusername"
FWIW this container worked instantlly for me, and easily mapped to a user on my server:
docker run -d -p 445:445 -e TZ=Europe/Madrid \ -v /opt:/opt elswork/samba \ -u "1000:1000:myusername:myusername:apassword" \ -s "SmbShare:/opt:rw:myusername"
Thanks for this...
My own case, for a simple share with guest access:
docker run -d -p 445:445 --name=samba --hostname 'samba' \
-e TZ=America/New_York \
-e PUID=1000 \
-e PGID=1000 \
-v /media/share:/share \
elswork/samba \
-s "share:/share:rw"
With 777 permissions on the share directory. Done, can access the shares from any systems without user/password. I was seriously pulling my hair out!
Any progress on this? Seems shares only work in guest mode. I wasted an entire day trying to get it to work. I've have no idea what's wrong. Logs are basically empty.
User a different docker image. This one is no good. Suggestion here: https://github.com/dperson/samba/issues/380#issuecomment-860031088
Actually I can't get elswork/samba working at all. I can't even get a list of the shares using the ip only to access. No permissions for that. No idea where to go from there.
Hi guys, after many hours i resolve this issue with this config
version: '3.4'
services: samba: image: dperson/samba container_name: samba environment: - TZ=America/Santiago - USERID=0 - GROUPID=0 - WORKGROUP=Homeserver ports: - "137:137/udp" - "138:138/udp" - "139:139/tcp" - "445:445/tcp" tmpfs: - /tmp restart: unless-stopped stdin_open: true read_only: false tty: true volumes: - '/mnt/toshiba:/mnt:z' - '/mnt/toshiba/Claudia:/Clau:z' command: '-s "Toshiba;/mnt;yes;no;no;admin;''none'';''none'';''Homeserver''" -s "Clau;/Clau;yes;no;no;clau;''none'';''none'';''Homeserver''" -u "admin;password" -u "clau;1234"'
I hope this help you!
I know this is an old thread but this was a tremendous help. I was getting user ID assigned as 100 to all my shares but now I've set them correctly and they're working great.
I can't understand why force user
and force group
are hardwired in smb.conf
. I removed those and everything started working as intended.