-
Notifications
You must be signed in to change notification settings - Fork 60
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
Change adduser to useradd #61
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -14,12 +14,12 @@ echo | |||||
|
||||||
if [ "$PASSWORD_1" == "$PASSWORD_2" ] && [ "$PASSWORD_1" != "" ] && [ "$USERNAME" != "" ] | ||||||
then | ||||||
adduser -D -H -s /bin/false "$USERNAME" 2> /dev/null >/dev/null | ||||||
useradd -u "$ACCOUNT_UID" -s /bin/false "$ACCOUNT_NAME" 2> /dev/null >/dev/null | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here you have a mistake:
Suggested change
|
||||||
smbpasswd -a -n "$USERNAME" 2> /dev/null >/dev/null | ||||||
echo -e "$PASSWORD_1\n$PASSWORD_1" | passwd "$USERNAME" 2> /dev/null >/dev/null | ||||||
echo -e "$PASSWORD_1\n$PASSWORD_1" | smbpasswd "$USERNAME" 2> /dev/null >/dev/null | ||||||
cat /var/lib/samba/private/smbpasswd | grep ':$' | grep '^'"$USERNAME"':[0-9]*:' | ||||||
exit 0 | ||||||
fi | ||||||
|
||||||
exit 1 | ||||||
exit 1 |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -71,7 +71,7 @@ if [ ! -f "$INITALIZED" ]; then | |||||
GROUP_NAME=$(echo "$I_CONF" | sed 's/^GROUP_//g' | sed 's/=.*//g') | ||||||
GROUP_ID=$(echo "$I_CONF" | sed 's/^[^=]*=//g') | ||||||
echo ">> GROUP: adding group $GROUP_NAME with GID: $GROUP_ID" | ||||||
addgroup -g "$GROUP_ID" "$GROUP_NAME" | ||||||
groupadd -g "$GROUP_ID" "$GROUP_NAME" | ||||||
done | ||||||
|
||||||
## | ||||||
|
@@ -87,10 +87,10 @@ if [ ! -f "$INITALIZED" ]; then | |||||
if [ "$ACCOUNT_UID" -gt 0 ] 2>/dev/null | ||||||
then | ||||||
echo ">> ACCOUNT: adding account: $ACCOUNT_NAME with UID: $ACCOUNT_UID" | ||||||
adduser -D -H -u "$ACCOUNT_UID" -s /bin/false "$ACCOUNT_NAME" | ||||||
useradd -u "$ACCOUNT_UID" -s /bin/false "$ACCOUNT_NAME" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are missing
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And we probably want to add |
||||||
else | ||||||
echo ">> ACCOUNT: adding account: $ACCOUNT_NAME" | ||||||
adduser -D -H -s /bin/false "$ACCOUNT_NAME" | ||||||
useradd -s /bin/false "$ACCOUNT_NAME" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
fi | ||||||
smbpasswd -a -n "$ACCOUNT_NAME" | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kjeldflarup, you missed
addgroup
on L113.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. I just pushed a commit with that change, but I did not test it :-)
But according to my man page, this addgroup command also seems to be incorrect, or at least not portable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it on Ubutu and Alipine Linux, it works as expected. 😉
The old
adduser
command works on Alpine Linux, where it is installed as part of Busybox which is quite limited and uses different options from its other implementations.