Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entrypoint Conf parse not right #67

Closed
addohm opened this issue Jul 25, 2023 · 3 comments
Closed

Entrypoint Conf parse not right #67

addohm opened this issue Jul 25, 2023 · 3 comments

Comments

@addohm
Copy link

addohm commented Jul 25, 2023

Behaviour

No shares are showing.

Here is the smb.conf as it was parsed by entrypoint.sh:

{"name":"public","comment":"Public","path":"/samba/public","browsable":"yes","readonly":"yes","guestok":"yes","veto":"no","recycle":"yes"}
{"name":"addohm","path":"/samba/addohm","browsable":"yes","readonly":"no","guestok":"no","validusers":"addohm","writelist":"addohm","veto":"no"}
{"name":"liyu","path":"/samba/liyu","browsable":"yes","readonly":"no","guestok":"no","validusers":"liyu","writelist":"liyu","veto":"no","hidefiles":"/_*/"}

Looks like json?

Here is how I have the config.yml set up

global:
  - "force user = addohm"
  - "force group = addohm"

  - name: public
    comment: Public
    path: /samba/public
    browsable: yes
    readonly: yes
    guestok: yes
    veto: no
    recycle: yes
  - name: addohm
    path: /samba/addohm
    browsable: yes
    readonly: no
    guestok: no
    validusers: addohm
    writelist: addohm
    veto: no
  - name: liyu
    path: /samba/liyu
    browsable: yes
    readonly: no
    guestok: no
    validusers: liyu
    writelist: liyu
    veto: no
    hidefiles: /_*/

if I manually correct the /etc/samba/smb.conf with the following everything works as expected

[public]                       
    comment = Public              
    path = /samba/public                                                                                                                  
    browsable = yes                                                                                                                             
    readonly = no                                                                                                                                          
    guest ok = yes                     
    veto = no                          
    recycle = yes                 
                                                                                                                                          
[addohm]                                                                                                                                        
    path = /samba/addohm                                                                                                                                   
    browsable = yes   
    readonly = no                 
    guest ok = no                
    validusers = addohm                                                                                                                   
    writelist = addohm                                                                                                                          
    veto = no                                                                                                                                              
                        
[liyu]                            
    path = /samba/liyu                         
    browsable = yes                                                                                                                       
    readonly = no                                                                                                                               
    guest ok = no                                                                                                                                          
    validusers = liyu   
    writelist = liyu              
    veto = no
  • Docker version (type docker --version) : Docker version 24.0.4, build 3713ee1
  • Platform (Debian 9, Ubuntu 18.04, ...) : Debian 12
  • System info (type uname -a) : Linux theserver 6.1.0-10-amd64 Add ZeroConf Service Discovery #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 GNU/Linux
  • Include all necessary configuration files : docker-compose.yml, .env, ...

docker compose:

version: "3.5"

services:
  samba:
    image: crazymax/samba
    container_name: samba
    network_mode: host
    volumes:
      - "./config:/data"
      - "./data/public:/samba/public"
      - "./data/addohm:/samba/addohm"
      - "./data/liyu:/samba/liyu"
    environment:
      - "TZ=America/New_York"
      - "SAMBA_LOG_LEVEL=0"
    restart: always

Docker info

> Output of command `docker info`
Client: Docker Engine - Community
 Version:    24.0.4
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.19.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 5
  Running: 5
  Paused: 0
  Stopped: 0
 Images: 7
 Server Version: 24.0.4
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: v1.1.7-0-g860f061
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.1.0-10-amd64
 Operating System: Debian GNU/Linux 12 (bookworm)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 3.772GiB
 Name: levenas
 ID: afbcd55c-e29d-44f9-b2d1-ef804f49e3f9
 Docker Root Dir: /raid/docker
 Debug Mode: false
 Username: addohm
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false```
### Logs

Container logs (set LOG_LEVEL to debug if applicable)

Setting timezone to America/New_York
Initializing files and folders
Setting global configuration
Creating user addohm/addohm (1000:1000)
Added user addohm.
Creating user liyu/liyu (1001:1001)
Added user liyu.
Add global option: force user = addohm
Add global option: force group = addohm
Add global option: {"name":"public","comment":"Public","path":"/samba/public","browsable":"yes","readonly":"yes","guestok":"yes","veto":"no","recycle":"yes"}
Add global option: {"name":"addohm","path":"/samba/addohm","browsable":"yes","readonly":"no","guestok":"no","validusers":"addohm","writelist":"addohm","veto":"no"}
Add global option: {"name":"liyu","path":"/samba/liyu","browsable":"yes","readonly":"no","guestok":"no","validusers":"liyu","writelist":"liyu","veto":"no","hidefiles":"/_*/"}
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed by GnuTLS (e.g. NTLM as a compatibility fallback)
Server role: ROLE_STANDALONE

Global parameters

[global]
disable netbios = Yes
disable spoolss = Yes
dns proxy = No
local master = No
map to guest = Bad User
pam password change = Yes
printcap name = /dev/null
security = USER
server role = standalone server
server services = s3fs, rpc, wrepl, ldap, cldap, kdc, drepl, winbindd, ntp_signd, kcc, dnsupdate
server string = Docker Samba Server
smb1 unix extensions = No
smb ports = 445
usershare allow guests = Yes
winbind scan trusted domains = Yes
fruit:time machine = yes
fruit:delete_empty_adfiles = yes
fruit:wipe_intentionally_left_blank_rfork = yes
fruit:veto_appledouble = no
fruit:posix_rename = yes
fruit:model = MacSamba
fruit:metadata = stream
idmap config * : backend = tdb
create mask = 0664
directory mask = 0775
force create mode = 0664
force directory mode = 0775
force group = addohm
force user = addohm
hosts allow = 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
hosts deny = 0.0.0.0/0
printing = bsd
strict locking = No
vfs objects = fruit streams_xattr
wide links = Yes
smbd version 4.18.3 started.
Copyright Andrew Tridgell and the Samba Team 1992-2023```

@crazy-max
Copy link
Owner

crazy-max commented Jul 26, 2023

Here is how I have the config.yml set up

global:
  - "force user = addohm"
  - "force group = addohm"

  - name: public
    comment: Public
    path: /samba/public
    browsable: yes
    readonly: yes
    guestok: yes
    veto: no
    recycle: yes
  - name: addohm
    path: /samba/addohm
    browsable: yes
    readonly: no
    guestok: no
    validusers: addohm
    writelist: addohm
    veto: no
  - name: liyu
    path: /samba/liyu
    browsable: yes
    readonly: no
    guestok: no
    validusers: liyu
    writelist: liyu
    veto: no
    hidefiles: /_*/

Wrong syntax, you forgot the share section: https://github.com/crazy-max/docker-samba#configuration

I think we could add some basic validation to avoid this.

@addohm
Copy link
Author

addohm commented Jul 27, 2023

Yeah that works.

@addohm addohm closed this as completed Jul 27, 2023
@addohm addohm reopened this Jul 27, 2023
@addohm
Copy link
Author

addohm commented Jul 27, 2023

Let me know when you push that and I'll test.

@addohm addohm closed this as completed Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants