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
2f53c77da6
3 changed files with 20 additions and 16 deletions
|
@ -15,9 +15,9 @@ This is an automated build linked with the [debian](https://hub.docker.com/_/deb
|
|||
- Set UID/GID manually for your users if you want them to make changes to
|
||||
your mounted volumes with permissions matching your host filesystem.
|
||||
- Add directory names at the end, if you want to create them and/or set user
|
||||
owership. Perfect when you just want a fast way to upload something without
|
||||
ownership. Perfect when you just want a fast way to upload something without
|
||||
mounting any directories, or you want to make sure a directory is owned by
|
||||
a user.
|
||||
a user (chown -R).
|
||||
- Mount volumes in user's home direcotry.
|
||||
- The users are chrooted to their home directory, so you must mount the
|
||||
volumes in separate directories inside the user's home directory
|
||||
|
@ -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