Skip to content

Commit a834ba0

Browse files
committed
samba: fix usernames with spaces
Signed-off-by: nachoparker <nacho@ownyourbits.com>
1 parent f8af35b commit a834ba0

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

bin/ncp/NETWORKING/samba.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ EOF
6464
# create a share per Nextcloud user
6565
local USERS=()
6666
while read -r path; do
67-
USERS+=( "$( basename $( dirname "$path" ) )" )
67+
USERS+=( "$( basename "$(dirname "$path")" )" )
6868
done < <( ls -d "$DATADIR"/*/files )
6969

70-
for user in ${USERS[@]}; do
70+
for user in "${USERS[@]}"; do
7171
# Exclude users not matching group filter (if enabled)
7272
if [[ -n "$FILTER_BY_GROUP" ]] \
7373
&& [[ -z "$(ncc user:info "$user" --output=json | jq ".groups[] | select( . == \"${FILTER_BY_GROUP}\" )")" ]]
@@ -98,10 +98,10 @@ EOF
9898

9999
## create user with no login if it doesn't exist
100100
id "$user" &>/dev/null || adduser --disabled-password --force-badname --gecos "" "$user" || return 1
101-
echo -e "$PWD\n$PWD" | smbpasswd -s -a $user
101+
echo -e "$PWD\n$PWD" | smbpasswd -s -a "${user}"
102102

103-
usermod -aG www-data $user
104-
sudo chmod g+w $DIR
103+
usermod -aG www-data "${user}"
104+
sudo chmod g+w "${DIR}"
105105
done
106106

107107
update-rc.d smbd defaults

changelog.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

2-
[v1.46.1](https://github.com/nextcloud/nextcloudpi/commit/6f3bfb1) (2022-03-02) nc-datadir: include dotfiles
2+
[v1.46.2](https://github.com/nextcloud/nextcloudpi/commit/6f53314) (2022-03-02) samba: fix usernames with spaces
3+
4+
[v1.46.1](https://github.com/nextcloud/nextcloudpi/commit/b4ef137) (2022-03-02) nc-datadir: include dotfiles
35

46
[v1.46.0 ](https://github.com/nextcloud/nextcloudpi/commit/2b59e26) (2022-03-01) upgrade to NC23.0.2
57

0 commit comments

Comments
 (0)