mirror of
https://github.com/atmoz/sftp.git
synced 2024-11-17 12:51:33 -05:00
Only change permission on newly created dirs
This commit is contained in:
parent
da53454b4b
commit
ce4a480b3e
1 changed files with 11 additions and 7 deletions
18
entrypoint
18
entrypoint
|
@ -91,14 +91,18 @@ function createUser() {
|
||||||
chmod 600 /home/$user/.ssh/authorized_keys
|
chmod 600 /home/$user/.ssh/authorized_keys
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure dirs exists and has correct permissions
|
# Make sure dirs exists
|
||||||
if [ -n "$dir" ]; then
|
if [ -n "$dir" ]; then
|
||||||
IFS=',' read -a dirParam <<< $dir
|
IFS=',' read -a dirArgs <<< $dir
|
||||||
for dirPath in ${dirParam[@]}; do
|
for dirPath in ${dirArgs[@]}; do
|
||||||
dirPath=/home/$user/$dirPath
|
dirPath="/home/$user/$dirPath"
|
||||||
echo "Creating and/or setting permissions on $dirPath"
|
if [ ! -d "$dirPath" ]; then
|
||||||
mkdir -p $dirPath
|
log "Creating directory: $dirPath"
|
||||||
chown -R $uid:users $dirPath
|
mkdir -p $dirPath
|
||||||
|
chown -R $uid:users $dirPath
|
||||||
|
else
|
||||||
|
log "Directory already exists: $dirPath"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue