Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Selfhosted
  3. samba docker compose help ver2

samba docker compose help ver2

Scheduled Pinned Locked Moved Selfhosted
selfhosted
16 Posts 7 Posters 71 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B [email protected]

    I would suggest adding "UID" and "GID" environment variables to the container, and set them to the numeric values for user and group numbers that show in place of your name when you use "ls -an" inside of the "mount" folder (they will probably be the same number).

    For example, if inside your mount folder you see:

    ls -an
    total 12
    drwx------ 2 1001 1001 4096 Mar 27 13:54 .
    drwxr-xr-x 3 1000 1000 4096 Mar 27 13:51 ..
    -rwx------ 1 1001 1001    0 Mar 27 13:54 hello.txt
    -rwx------ 1 1001 1001    4 Mar 27 13:54 test.txt
    

    Then set UID: 1001 and GID: 1001

    I get the same error as you when I copy your docker-compose and try to access a folder owned by my user. When I add the UID and GID of my user id to the docker-compose (1007 for me), the error goes away.

    ? Offline
    ? Offline
    Guest
    wrote on last edited by
    #7

    Thanks for the suggestion. I tried and it still doesn't work. I updated the google docs notes with my steps if you want to see what I did.

    B 1 Reply Last reply
    0
    • C [email protected]

      Try the users suggestion from the other post and run "ls -an" to see the numeric user IDs rather than the names you're assigning. I've recently been building a new server with proxmox and learned this same lesson already as user "1000" gets assigned as user "100000" inside containers there to prevent it from having host permissions automatically from my understanding.

      ? Offline
      ? Offline
      Guest
      wrote on last edited by
      #8

      Do I need to enter the container bash and change something then? I tried adding UID and GID to the docker compose file, but it still fails. I updated the google docs notes if you want to see my steps.

      1 Reply Last reply
      0
      • ? Guest

        Thanks for the suggestion. I tried and it still doesn't work. I updated the google docs notes with my steps if you want to see what I did.

        B This user is from outside of this forum
        B This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #9

        Hmm, well it doesn't seem to be any problem with the docker compose then as best as I can tell. I picked a random ext4 flash drive and replicated your setup with the UID and GID set and it seems to work fine:

        # /etc/fstab
        /dev/sda1       /home/<me>/mount/ext_hdd_01  ext4    defaults 0 2
        
        ~/mount % ls -an
        total 12
        drwxr-xr-x  3 1000 1000 4096 Mar 27 16:22 .
        drwx------ 86 1000 1000 4096 Mar 27 16:31 ..
        drwxrwxrwx  3    0    0 4096 Mar 27 16:26 ext_hdd_01
        
        ~/mount/ext_hdd_01 % ls -an
        total 6521728
        drwxrwxrwx 3    0    0       4096 Mar 27 16:26 .
        drwxr-xr-x 3 1000 1000       4096 Mar 27 16:22 ..
        -rw-r--r-- 1 1000 1000 6678214224 May  5  2024 PXL_20240504_233345242.mp4
        drwxrwxrwx 2    0    0      16384 May  5  2024 lost+found
        -rwxr--r-- 1 1000 1000          5 Mar 27 16:27 test.txt
        
        # ~/samba/docker-compose.yml
        services:
          samba:
            image: dockurr/samba
            container_name: samba
            environment:
              NAME: "Data"
              USER: "user"
              PASS: "pass"
              UID: "1000"
              GID: "1000"
            ports:
              - 445:445
            volumes:
              - /home/<me>/mount:/storage
            restart: always
        

        I was able to play the PXL.mp4 video from my desktop and write back the test.txt file

        Have you checked the logs with docker logs -f samba to see if there's anything there?

        Also you could try to access the HD from within the container, using docker exec -it samba bash and then cd into /storage and see what happens.

        ? 1 Reply Last reply
        0
        • B [email protected]

          Hmm, well it doesn't seem to be any problem with the docker compose then as best as I can tell. I picked a random ext4 flash drive and replicated your setup with the UID and GID set and it seems to work fine:

          # /etc/fstab
          /dev/sda1       /home/<me>/mount/ext_hdd_01  ext4    defaults 0 2
          
          ~/mount % ls -an
          total 12
          drwxr-xr-x  3 1000 1000 4096 Mar 27 16:22 .
          drwx------ 86 1000 1000 4096 Mar 27 16:31 ..
          drwxrwxrwx  3    0    0 4096 Mar 27 16:26 ext_hdd_01
          
          ~/mount/ext_hdd_01 % ls -an
          total 6521728
          drwxrwxrwx 3    0    0       4096 Mar 27 16:26 .
          drwxr-xr-x 3 1000 1000       4096 Mar 27 16:22 ..
          -rw-r--r-- 1 1000 1000 6678214224 May  5  2024 PXL_20240504_233345242.mp4
          drwxrwxrwx 2    0    0      16384 May  5  2024 lost+found
          -rwxr--r-- 1 1000 1000          5 Mar 27 16:27 test.txt
          
          # ~/samba/docker-compose.yml
          services:
            samba:
              image: dockurr/samba
              container_name: samba
              environment:
                NAME: "Data"
                USER: "user"
                PASS: "pass"
                UID: "1000"
                GID: "1000"
              ports:
                - 445:445
              volumes:
                - /home/<me>/mount:/storage
              restart: always
          

          I was able to play the PXL.mp4 video from my desktop and write back the test.txt file

          Have you checked the logs with docker logs -f samba to see if there's anything there?

          Also you could try to access the HD from within the container, using docker exec -it samba bash and then cd into /storage and see what happens.

          ? Offline
          ? Offline
          Guest
          wrote on last edited by
          #10

          I'm CURSED I tells ya! I'll look at the logs tomorrow. Good to know that you can get it working. Maybe I'm close then.

          C 1 Reply Last reply
          0
          • ? Guest

            I'm CURSED I tells ya! I'll look at the logs tomorrow. Good to know that you can get it working. Maybe I'm close then.

            C This user is from outside of this forum
            C This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #11

            What displays when you run "id" as your user? You'll want it to match what your inputting in the docker compose. I may have missed it but I didn't see you identify what your personal UID and GID are in the Google doc.

            As a janky fallback, what if you just added a new smb user and password and see if that one connects: sudo smbpasswd -a <username>

            1 Reply Last reply
            0
            • ? Guest

              How do I tell? In the docker-compose.yml file I put the user and password for my server user. I thought that was going to make it work?

              B This user is from outside of this forum
              B This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #12

              In case you haven't realized, the user and pass in the docker compose are for setting the user/pass that you will enter on windows to access the share. It doesn't have to be the same as the Linux server user account - though mine is the same because it's easier to remember.

              possiblylinux127@lemmy.zipP ? 2 Replies Last reply
              0
              • ? Guest

                Hi,
                I made this post a few days ago:
                https://lemmy.world/post/27391713
                And I've been trying a lot of stuff and it doesn't work and it's driving me nuts.
                Now I tried again from the bottom and wrote down everything.
                You can see my notes here:
                https://docs.google.com/document/d/1vPplJhjZ13j1A2mEzHGS1B_sPSThE3LHxnGW82_F6Is/edit?usp=sharing
                Can anyone tell me why I keep banging my head against a wall here?
                Thanks 🙂

                possiblylinux127@lemmy.zipP This user is from outside of this forum
                possiblylinux127@lemmy.zipP This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #13

                Don't do this

                Samba was not designed to be containerized. Install Samba native and try again. I'm almost certain the problem will go away.

                irmadlad@lemmy.worldI 1 Reply Last reply
                0
                • B [email protected]

                  In case you haven't realized, the user and pass in the docker compose are for setting the user/pass that you will enter on windows to access the share. It doesn't have to be the same as the Linux server user account - though mine is the same because it's easier to remember.

                  possiblylinux127@lemmy.zipP This user is from outside of this forum
                  possiblylinux127@lemmy.zipP This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #14

                  That's the old style of doing things.

                  These days everything is set via extended attributes.

                  1 Reply Last reply
                  0
                  • B [email protected]

                    In case you haven't realized, the user and pass in the docker compose are for setting the user/pass that you will enter on windows to access the share. It doesn't have to be the same as the Linux server user account - though mine is the same because it's easier to remember.

                    ? Offline
                    ? Offline
                    Guest
                    wrote on last edited by
                    #15

                    I did the same. Not because I knew, but because I was unsure if permissions would fail if I didn't.

                    1 Reply Last reply
                    0
                    • possiblylinux127@lemmy.zipP [email protected]

                      Don't do this

                      Samba was not designed to be containerized. Install Samba native and try again. I'm almost certain the problem will go away.

                      irmadlad@lemmy.worldI This user is from outside of this forum
                      irmadlad@lemmy.worldI This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #16

                      Samba was not designed to be containerized.

                      There are some things that shouldn't be containerized even tho they can be. I can see the benefit of a user wanting to containerize everything....it's one neat little package. I look at on a case by case basis. For instance, Caddy I installed on bare metal instead of a container even tho there is one for Caddy.

                      1 Reply Last reply
                      0
                      • System shared this topic on
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups