marcoh00 / docker-samba-ldap

A docker image for using samba with ldap
8 stars 4 forks source link

smbd can not open secrets.tdb #1

Open PengliangC opened 7 years ago

PengliangC commented 7 years ago

root@ubuntu:/# docker run -it --name samba -p 139:139 -p 445:445 -v /smb.conf:/etc/samba/smb.conf -v /secrets.tdb:/var/lib/samba/private/secrets.tdb -v /smbldap-tools:/etc/smbldap-tools -v /nslcd.conf:/etc/nslcd.conf -v /test:/srv -h ldap-host marcoh00/samba-ldap[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] log: applying... [fix-attrs.d] log: exited 0. [fix-attrs.d] volumes: applying... [fix-attrs.d] volumes: exited 0. [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] done. [services.d] starting services [services.d] done. smbd version 4.5.8-Debian started. Copyright Andrew Tridgell and the Samba Team 1992-2016 Failed to open /var/lib/samba/private/secrets.tdb Failed to open /var/lib/samba/private/secrets.tdb STATUS=daemon failed to start: smbd can not open secrets.tdb, error code 13 /usr/sbin/smbd exited 1 [cont-finish.d] executing container finish scripts... [cont-finish.d] done. [s6-finish] syncing disks. [s6-finish] sending all processes the TERM signal. [s6-finish] sending all processes the KILL signal and exiting.

marcoh00 commented 7 years ago

Hi! Nice to see the image is actually (tried to be) in use by someone else :)

However, I don't think this seems to be an issue with the image. Could you try to run bash instead and see if /var/lib/samba/private really exists and is a file? If so, could you check the permissions on the file and report back? Thanks!

docker run -it --name samba -p 139:139 -p 445:445 -v /smb.conf:/etc/samba/smb.conf -v /secrets.tdb:/var/lib/samba/private/secrets.tdb -v /smbldap-tools:/etc/smbldap-tools -v /nslcd.conf:/etc/nslcd.conf -v /test:/srv -h ldap-host marcoh00/samba-ldap bash
cd /var/lib/samba/private
stat secrets.tdb
maykel535 commented 6 years ago

I have a same problem...

test it:

$ docker run -it --name samba -p 139:139 -p 445:445 -v /smb.conf:/etc/samba/smb.conf -v /secrets.tdb:/var/lib/samba/private/secrets.tdb -v /smbldap-tools/:/etc/smbldap-tools -v /nslcd.conf:/etc/nslcd.conf -v /some/share:/some/share marcoh00/samba-ldap bash [s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] log: applying... [fix-attrs.d] log: exited 0. [fix-attrs.d] volumes: applying... [fix-attrs.d] volumes: exited 0. [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] done. [services.d] starting services [services.d] done.

And:

root@61469cc47617:/var/lib/samba/private# cat secrets.tdb/ cat: secrets.tdb/: Is a directory

root@61469cc47617:/var/lib/samba/private# rm -rf secrets.tdb/ rm: cannot remove 'secrets.tdb/': Device or resource busy

I think cannot copy correct file secrets.tdb in /var/lib/samba/private/

marcoh00 commented 6 years ago

Hi!

Is your /secrets.tdb really a file? In case you have none yet, do not specify secrets.tdb as a volume. Then, you can create a secrets.tdb like specified inside the README (smbpasswd -w) and copy it out of the container using docker cp. After you have obtained one, you can mount the file inside the container like you did.