samba icon indicating copy to clipboard operation
samba copied to clipboard

Can mount but no write permissions

Open MrksHfmn opened this issue 4 years ago • 6 comments

thanks a lot for the docker image! so far it works really well, unfortunately i can't write with my user. the write permissions on the host system are correct. i tried to set the uids and gids in the compose file.

version: '3.8'

services:
  samba:
    image: dperson/samba
    container_name: samba
    environment:
      - TZ="Europe/Berlin"
    networks:
      - samba
    ports:
      - "137:137/udp"
      - "138:138/udp"
      - "139:139/tcp"
      - "445:445/tcp"
    restart: unless-stopped
    volumes:
      - /mnt/storage/users/markus:/mnt/users/markus/
    command: >
      -w "WORKGROUP"
      -s "Markus Daten;/mnt/users/markus;yes;no;no;markus"
      -u "markus;Test123;1000;markus;1000"

networks:
  samba:
    external: true

Host system:

root@HOME-SERVER:[users]> ls -la /mnt/storage/users/
drwxr-xr-x 5 markus markus 4,0K 2020-09-01, 14:58:13   markus/

root@HOME-SERVER:[users]> id markus
uid=1000(markus) gid=1000(markus) groups=1000(markus),976(docker),991(lp)

MrksHfmn avatar Sep 02 '20 04:09 MrksHfmn

try USERID and GROUPID environments instead "1000;markus;1000" on command. I had same issue but I resolved with it.

mainto avatar Sep 07 '20 09:09 mainto

version: '3.8'

services:
  samba:
    image: dperson/samba
    environment:
      - TZ="Europe/Berlin"
    ports:
      - "137:137/udp"
      - "138:138/udp"
      - "139:139/tcp"
      - "445:445/tcp"
    restart: unless-stopped
    volumes:
      - /home/user:/home/user
    command: >
        -u "user;pass;1000;user;1000"
        -s "user private share;/home/user;yes;no;no;user"
        -p

Works for me. I think you should add the "-p" flag in command.

Melzmann avatar Sep 24 '20 08:09 Melzmann

I was able to get write access by resetting the forced user and group using

-g "force user =" -g "force group ="

DrDOIS avatar Oct 11 '20 15:10 DrDOIS

The force user being set to smbuser was preventing me from being able to write to my home dir. I manually edited /etc/samba/smb.conf, but will try the -g "force user =" -g "force group =" option next time I recreate the container.

Using the -p option just chmod'd every file to another user - which is INSANE!!!

ZeBadger avatar Oct 22 '20 11:10 ZeBadger

disable the option vfs in smb.conf like this:

# vfs objects = catia...

sunnyseaman avatar May 09 '21 08:05 sunnyseaman

I was able to get write access by resetting the forced user and group using

-g "force user =" -g "force group ="

This was what i needed. It was very frustrating wondering why I created a USER=foo;foo;1000;foo;1000 and writes being performed under that user was writing under USERID and GROUPID (i.e. smbuser's permissions).

Perhaps im missing something, but i'm not getting why the user is forced to be smbuser in this image. The entire point of a user system is that a user connecting to a share should run under their own permissions. And force user does the opposite, making all users run under a specific user's permission: https://wiki.samba.org/index.php/Setting_up_Samba_as_a_Standalone_Server#Using_the_force_Parameters

leojonathanoh avatar Sep 14 '21 20:09 leojonathanoh