0
0
Fork 0
mirror of https://github.com/atmoz/sftp.git synced 2024-11-17 12:51:33 -05:00

Do not create users on container restart

This commit is contained in:
Adrian Dvergsdal 2015-12-16 19:41:49 +01:00
parent 55d879419f
commit c388a4ec68

View file

@ -35,6 +35,11 @@ function createUser() {
gid="${param[3]}"
fi
if $(cat /etc/passwd | cut -d: -f3 | grep -q "$uid"); then
echo "User with UID \"$uid\" already exists, skipping."
return 0
fi
useraddOptions="--no-user-group"
if [ -n "$uid" ]; then
@ -75,6 +80,9 @@ if [ "$1" == "--readme" ]; then
exit 0
fi
# Create final config
if [ ! -f "$userConfFinalPath" ]; then
# Append mounted config to final config
if [ -f "$userConfPath" ]; then
cat "$userConfPath" >> "$userConfFinalPath"
@ -103,4 +111,6 @@ while IFS= read -r user || [[ -n "$user" ]]; do
createUser "$user"
done < "$userConfFinalPath"
fi
exec /usr/sbin/sshd -D