ServerContainers / samba

samba - (ghcr.io/servercontainers/samba) (+ optional zeroconf, wsdd2 & time machine) on alpine [x86 + arm]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No access to shared folder

arnolddwarf opened this issue · comments

Hello.

I'm struggling to get the container to work, but no supply. Here I leave my compose file in case I am failing something

  samba:
    build: .
    image: ghcr.io/servercontainers/samba
    container_name: samba
    restart: unless-stopped
    network_mode: host
    environment:
      MODEL: 'TimeCapsule'
      AVAHI_NAME: OPI
      SAMBA_CONF_LOG_LEVEL: 3
      GROUP_family: 0
      ACCOUNT_arnold: arnold123
      UID_arnold: 0
      GROUPS_arnold: family
      SAMBA_VOLUME_CONFIG_arnoldonly: "[arnold]; path=/shares/arnold; valid users = arnold; guest ok = no; read only = no; browseable = yes"
    volumes:
      - /mnt/opidata:/shares/arnold

Here the end of the log:

`samba | [2023/12/01 06:18:52.723795, 0] ../../source3/nmbd/nmbd_become_lmb.c:398(become_local_master_stage2)
samba | *****
samba |
samba | Samba name server ORANGEPI3B is now a local master browser for workgroup WORKGROUP on subnet 172.17.0.1
samba |
samba | *****
samba | [2023/12/01 06:18:52.724108, 3] ../../source3/nmbd/nmbd_namelistdb.c:257(add_name_to_subnet)
samba | add_name_to_subnet: Added netbios name WORKGROUP<1d> with first IP 192.168.100.44 ttl=0 nb_flags= 0 to subnet 192.168.100.44
samba | [2023/12/01 06:18:52.724164, 3] ../../source3/nmbd/nmbd_become_lmb.c:354(become_local_master_stage2)
samba | become_local_master_stage2: registered as master browser for workgroup WORKGROUP on subnet 192.168.100.44
samba | [2023/12/01 06:18:52.724186, 3] ../../source3/nmbd/nmbd_sendannounce.c:70(broadcast_announce_request)
samba | broadcast_announce_request: sending announce request for workgroup WORKGROUP to subnet 192.168.100.44
samba | [2023/12/01 06:18:52.724384, 0] ../../source3/nmbd/nmbd_become_lmb.c:398(become_local_master_stage2)
samba | *****
samba |
samba | Samba name server ORANGEPI3B is now a local master browser for workgroup WORKGROUP on subnet 192.168.100.44
samba |
samba | *****
samba | [2023/12/01 06:18:52.724916, 3] ../../source3/nmbd/nmbd_sendannounce.c:170(send_local_master_announcement)
samba | send_local_master_announcement: type 849a03 for name ORANGEPI3B on subnet 172.17.0.1 for workgroup WORKGROUP
samba | [2023/12/01 06:18:52.725151, 3] ../../source3/nmbd/nmbd_sendannounce.c:189(send_workgroup_announcement)
samba | send_workgroup_announcement: on subnet 172.17.0.1 for workgroup WORKGROUP
samba | [2023/12/01 06:18:52.725321, 3] ../../source3/nmbd/nmbd_sendannounce.c:170(send_local_master_announcement)
samba | send_local_master_announcement: type 849a03 for name ORANGEPI3B on subnet 192.168.100.44 for workgroup WORKGROUP
samba | [2023/12/01 06:18:52.725476, 3] ../../source3/nmbd/nmbd_sendannounce.c:189(send_workgroup_announcement)
samba | send_workgroup_announcement: on subnet 192.168.100.44 for workgroup WORKGROUP
samba | [2023/12/01 06:19:12.751809, 3] ../../source3/nmbd/nmbd_serverlistdb.c:414(write_browse_list)
samba | write_browse_list: Wrote browse list into file /var/cache/samba/browse.dat
samba | [2023/12/01 06:21:02.873184, 3] ../../source3/nmbd/nmbd_sendannounce.c:170(send_local_master_announcement)
samba | send_local_master_announcement: type 849a03 for name ORANGEPI3B on subnet 172.17.0.1 for workgroup WORKGROUP

`

Please, could you tell me what I'm doing wrong, or maybe I'm writing the address wrong from my windows 10 (⧵⧵192.168.100.44⧵arnold)

Hi Arnold, I'm pretty sure it's because of the UID environment variables - please choose values above 1000 and try again

if you just want your arnold only share, you can remove the group stuff completely.

Hey @MarvAmBass

re-opening this issue as I am desparetly looking for help.

I try the setup as described in the README.

Running the container on a debian VM in docker.

docker-compose.yaml:

services:
  samba:
    image: ghcr.io/servercontainers/samba
    container_name: samba
    restart: always
    network_mode: host
    environment:
      MODEL: 'TimeCapsule'
      AVAHI_NAME: dockervm
      SAMBA_CONF_LOG_LEVEL: 3
      WSDD2_DISABLE: 1

      GROUP_fgeck: 1000
      ACCOUNT_fgeck: test
      GROUPS_fgeck: fgeck
      UID_fgeck: 1000
      SAMBA_VOLUME_CONFIG_public: "[data]; path=/mnt/data; valid users = fgeck; guest ok = yes; read only = no; 

    volumes:
      - /etc/avahi/services/:/external/avahi
      - /mnt/data:/mnt/data

I can access the VM by the static IP: 192.168.178.100
image

But when I use the credentials (fgeck / test) I get following error:
image

Cheking the smbpasswd file in the container I can see that it is empty:

/ # ls -lah /var/lib/samba/private/
total 436K   
drwx------    1 root     root        4.0K Apr  4 14:50 .
drwxr-xr-x    1 root     root        4.0K Apr  4 14:50 ..
drwx------    2 root     root        4.0K Apr  4 14:50 msg.sock
-rw-------    1 root     root      420.0K Apr  4 14:50 secrets.tdb
-rw-------    1 root     root           0 Apr  4 14:50 smbpasswd

2nd approach was using the script docker run -ti --rm --entrypoint create-hash.sh ghcr.io/servercontainers/samba. Unfortunately error on windows stays the same and sambpasswd file stays empty:

 docker exec -ti samba cat /var/lib/samba/private/smbpasswd

hi I found a few mistakes in your config

services:
  samba:
    image: ghcr.io/servercontainers/samba
    container_name: samba
    restart: always
    network_mode: host
    environment:
      MODEL: 'TimeCapsule'
      AVAHI_NAME: dockervm
      SAMBA_CONF_LOG_LEVEL: 3
      WSDD2_DISABLE: 1

      ACCOUNT_fgeck: test
      UID_fgeck: 1000
      SAMBA_VOLUME_CONFIG_public: "[data]; path=/mnt/data; valid users = fgeck; guest ok = yes; read only = no; 

    volumes:
      - /etc/avahi/services/:/external/avahi
      - /mnt/data:/mnt/data

maybe this resolves the issue

you're specifing a default group, this makes the user creation script fail, fgeck was already existing after the user was created, or the user is not being able to be created since the group with that name is already existing.

it's a bad combination - the group envs are for grouping e.g. an apartment/family/group of friends, not for manually doing default linux group behavior

P.S. make sure the directories on the debian host have ownership for your samba container user/group ids - if there is no group with that name on the host you can use chown with the ids

Thank you very much for that fast answer!

On a first try it did not solve the issue, but when I restarted the Windows machine I was able to access the samba share.
After that I changed the password to be used from my .env file - same problem "Permission Denied".
Restarted Windows again and I can access the samba share again :-)

So for anyone running into the same issue:
if your conifg is 100% valid try restarting Windows.
And in case someone has stored the wrong credentials, go to "Credentials Manager" -> "Windows Credentials" -> remove the ones from the samba share

that sounds good, and it seems to me, that windows is caching some of the connection informations and keeps you from getting a mount without a restart - glad i could help :)