Merge pull request #7891 from mglae/le12_samba_config_smbpasswd

samba: samba-config: call smbpasswd with valid smb.conf
This commit is contained in:
CvH 2023-06-17 11:57:35 +02:00 committed by GitHub
commit 1c6f55dc60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,14 +98,15 @@ if [ ! -f /storage/.cache/services/samba.disabled ]; then
# processing continues, so if user chooses root as username, second line overrides the first # processing continues, so if user chooses root as username, second line overrides the first
# this is done always in case user uses passwords in userconf. # this is done always in case user uses passwords in userconf.
# many thanks to viljoviitanen for this # many thanks to viljoviitanen for this
printf "%s\n%s" "${SAMBA_PASSWORD}" "${SAMBA_PASSWORD}" | smbpasswd -s -a root >/dev/null 2>&1
printf 'nobody = root\nroot = "%s"\n' "${SAMBA_USERNAME}" > /run/samba/samba.map
sed -e 's|^.[ \t]*.public.=.*| public = no |' \ sed -e 's|^.[ \t]*.public.=.*| public = no |' \
-e 's|^.[ \t]*.username map.=.*||' \ -e 's|^.[ \t]*.username map.=.*||' \
-e 's|^.[ \t]*.security.=.*| security = user\n username map = /run/samba/samba.map|' \ -e 's|^.[ \t]*.security.=.*| security = user\n username map = /run/samba/samba.map|' \
-e 's|^.[ \t]*.map.to.guest.=.*| map to guest = Never|' \ -e 's|^.[ \t]*.map.to.guest.=.*| map to guest = Never|' \
-i ${SMB_TMP} -i ${SMB_TMP}
printf "%s\n%s" "${SAMBA_PASSWORD}" "${SAMBA_PASSWORD}" | smbpasswd -c ${SMB_TMP} -s -a root
printf 'nobody = root\nroot = "%s"\n' "${SAMBA_USERNAME}" > /run/samba/samba.map
else else
sed -e 's|^.[ \t]*.public.=.*| public = yes |' \ sed -e 's|^.[ \t]*.public.=.*| public = yes |' \
-e 's|^.[ \t]*.username map.=.*||' \ -e 's|^.[ \t]*.username map.=.*||' \