mirror of
https://github.com/atmoz/sftp.git
synced 2024-11-17 12:51:33 -05:00
Fix dir for loop
This commit is contained in:
parent
d4a108f53a
commit
d961e18d73
3 changed files with 18 additions and 14 deletions
|
@ -97,7 +97,7 @@ Tip: you can use [atmoz/makepasswd](https://hub.docker.com/r/atmoz/makepasswd/)
|
|||
|
||||
## Using SSH key (and no password)
|
||||
|
||||
Mount all public keys in the user's `.ssh/keys/` direcotry. All keys are automatically
|
||||
Mount all public keys in the user's `.ssh/keys/` directory. All keys are automatically
|
||||
appended to `.ssh/authorized_keys`.
|
||||
|
||||
```
|
||||
|
|
15
entrypoint
15
entrypoint
|
@ -77,14 +77,13 @@ function createUser() {
|
|||
|
||||
# Make sure dirs exists and has correct permissions
|
||||
if [ -n "$dir" ]; then
|
||||
while IFS=',' read -ra dirParam; do
|
||||
for dirPath in $dirParam; do
|
||||
dirPath=/home/$user/$dirPath
|
||||
echo "Creating and/or setting permissions on $dirPath"
|
||||
mkdir -p $dirPath
|
||||
chown -R $user:users $dirPath
|
||||
done
|
||||
done <<< $dir
|
||||
IFS=',' read -a dirParam <<< $dir
|
||||
for dirPath in ${dirParam[@]}; do
|
||||
dirPath=/home/$user/$dirPath
|
||||
echo "Creating and/or setting permissions on $dirPath"
|
||||
mkdir -p $dirPath
|
||||
chown -R $user:users $dirPath
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
15
tests/run
15
tests/run
|
@ -36,7 +36,7 @@ function beforeTest() {
|
|||
rm -rf "$tmpDir" # clean state
|
||||
mkdir "$tmpDir"
|
||||
|
||||
echo "test::$(id -u):$(id -g):dir" >> "$tmpDir/users"
|
||||
echo "test::$(id -u):$(id -g):share,dir1,dir2" >> "$tmpDir/users"
|
||||
docker run \
|
||||
-v "$tmpDir/users:/etc/sftp-users.conf:ro" \
|
||||
-v "$scriptDir/id_rsa.pub":/home/test/.ssh/keys/id_rsa.pub:ro \
|
||||
|
@ -123,11 +123,16 @@ function testDir() {
|
|||
|
||||
runSftpCommands "$sftpContainerName" \
|
||||
"test" \
|
||||
"cd dir" \
|
||||
"mkdir test2" \
|
||||
"get -rf test2 $tmpDir/" \
|
||||
"cd dir1" \
|
||||
"mkdir test-dir1" \
|
||||
"get -rf test-dir1 $tmpDir/" \
|
||||
"cd ../dir2" \
|
||||
"mkdir test-dir2" \
|
||||
"get -rf test-dir2 $tmpDir/" \
|
||||
"exit"
|
||||
test -d "$tmpDir/test2"
|
||||
test -d "$tmpDir/test-dir1"
|
||||
assertReturn $? 0
|
||||
test -d "$tmpDir/test-dir2"
|
||||
assertReturn $? 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue