dperson / samba

Samba docker container
GNU Affero General Public License v3.0
1.54k stars 517 forks source link

Can mount but no write permissions #334

Open MrksHfmn opened 4 years ago

MrksHfmn commented 4 years ago

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)
mainto commented 4 years ago

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

Melzmann commented 4 years ago
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.

DrDOIS commented 4 years ago

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

-g "force user =" -g "force group ="
ZeBadger commented 4 years ago

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!!!

sunnyseaman commented 3 years ago

disable the option vfs in smb.conf like this:

# vfs objects = catia...

leojonathanoh commented 3 years ago

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