mirror of
https://github.com/atmoz/sftp.git
synced 2024-12-08 13:05:39 -05:00
Merge branch 'master' into alpine
This commit is contained in:
commit
9c3915700d
1 changed files with 3 additions and 3 deletions
|
@ -51,7 +51,7 @@ function createUser() {
|
||||||
gid="${args[$[$index+3]]}"; validateArg "GID" "$gid" "$reGid" || return 1
|
gid="${args[$[$index+3]]}"; validateArg "GID" "$gid" "$reGid" || return 1
|
||||||
dir="${args[$[$index+4]]}"; validateArg "dirs" "$dir" "$reDir" || return 1
|
dir="${args[$[$index+4]]}"; validateArg "dirs" "$dir" "$reDir" || return 1
|
||||||
|
|
||||||
if $(cat /etc/passwd | cut -d: -f1 | grep -q "^$user:"); then
|
if getent passwd $user > /dev/null; then
|
||||||
log "WARNING: User \"$user\" already exists. Skipping."
|
log "WARNING: User \"$user\" already exists. Skipping."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
@ -63,7 +63,7 @@ function createUser() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$gid" ]; then
|
if [ -n "$gid" ]; then
|
||||||
if ! $(cat /etc/group | cut -d: -f3 | grep -q "$gid"); then
|
if ! getent group $gid > /dev/null; then
|
||||||
groupadd --gid $gid "group_$gid"
|
groupadd --gid $gid "group_$gid"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ function createUser() {
|
||||||
|
|
||||||
# Retrieving user id to use it in chown commands instead of the user name
|
# Retrieving user id to use it in chown commands instead of the user name
|
||||||
# to avoid problems on alpine when the user name contains a '.'
|
# to avoid problems on alpine when the user name contains a '.'
|
||||||
uid=`id $user -u`
|
uid="$(id -u $user)"
|
||||||
|
|
||||||
if [ -n "$pass" ]; then
|
if [ -n "$pass" ]; then
|
||||||
echo "$user:$pass" | chpasswd $chpasswdOptions
|
echo "$user:$pass" | chpasswd $chpasswdOptions
|
||||||
|
|
Loading…
Reference in a new issue