mirror of
https://github.com/atmoz/sftp.git
synced 2024-11-17 12:51:33 -05:00
Rename variables
This commit is contained in:
parent
0661a5923e
commit
bf86e22d11
1 changed files with 7 additions and 7 deletions
14
entrypoint
14
entrypoint
|
@ -6,7 +6,7 @@ for users in "$@"; do
|
||||||
pass="${data[1]}"
|
pass="${data[1]}"
|
||||||
|
|
||||||
if [ "${data[2]}" == "e" ]; then
|
if [ "${data[2]}" == "e" ]; then
|
||||||
chpasswdParams="-e"
|
chpasswdOptions="-e"
|
||||||
uid="${data[3]}"
|
uid="${data[3]}"
|
||||||
gid="${data[4]}"
|
gid="${data[4]}"
|
||||||
else
|
else
|
||||||
|
@ -14,27 +14,27 @@ for users in "$@"; do
|
||||||
gid="${data[3]}"
|
gid="${data[3]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
useraddParams="--create-home --no-user-group"
|
useraddOptions="--create-home --no-user-group"
|
||||||
|
|
||||||
if [ -n "$uid" ]; then
|
if [ -n "$uid" ]; then
|
||||||
useraddParams="$useraddParams --non-unique --uid $uid"
|
useraddOptions="$useraddOptions --non-unique --uid $uid"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$gid" ]; then
|
if [ -n "$gid" ]; then
|
||||||
useraddParams="$useraddParams --gid $gid"
|
useraddOptions="$useraddOptions --gid $gid"
|
||||||
groupadd --gid $gid $gid
|
groupadd --gid $gid $gid
|
||||||
fi
|
fi
|
||||||
|
|
||||||
useradd $useraddParams "$user"
|
useradd $useraddOptions $user
|
||||||
chown root:root /home/$user
|
chown root:root /home/$user
|
||||||
chmod 755 /home/$user
|
chmod 755 /home/$user
|
||||||
|
|
||||||
if [ -z "$pass" ]; then
|
if [ -z "$pass" ]; then
|
||||||
pass="$(echo `</dev/urandom tr -dc A-Za-z0-9 | head -c256`)"
|
pass="$(echo `</dev/urandom tr -dc A-Za-z0-9 | head -c256`)"
|
||||||
chpasswdParams=""
|
chpasswdOptions=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$user:$pass" | chpasswd $chpasswdParams
|
echo "$user:$pass" | chpasswd $chpasswdOptions
|
||||||
done
|
done
|
||||||
|
|
||||||
exec /usr/sbin/sshd -D
|
exec /usr/sbin/sshd -D
|
||||||
|
|
Loading…
Reference in a new issue