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

Require user to handle file permissions

This commit is contained in:
Adrian Dvergsdal 2014-10-21 10:42:49 +02:00
parent b8d424d532
commit 60ab7d2f4f
2 changed files with 2 additions and 18 deletions

View file

@ -53,11 +53,11 @@ docker run \
Tip: you can use makepasswd to generate encrypted passwords: Tip: you can use makepasswd to generate encrypted passwords:
`echo -n 123 | makepasswd --crypt-md5 --clearfrom -` `echo -n 123 | makepasswd --crypt-md5 --clearfrom -`
### Use public key (without password) ### Using SSH key (without password)
``` ```
docker run \ docker run \
-v /host/id_rsa.pub:/public_keys/foo:ro \ -v /host/id_rsa.pub:/home/foo/.ssh/authorized_keys:ro \
-v /host/share:/home/foo/share \ -v /host/share:/home/foo/share \
-p 2222:22 -d atmoz/sftp \ -p 2222:22 -d atmoz/sftp \
foo::1001 foo::1001

16
run
View file

@ -30,26 +30,10 @@ for users in "$@"; do
chmod 755 /home/$user chmod 755 /home/$user
if [ -z "$pass" ]; then if [ -z "$pass" ]; then
# just make a very long and random password
pass="$(echo `</dev/urandom tr -dc A-Za-z0-9 | head -c256`)" pass="$(echo `</dev/urandom tr -dc A-Za-z0-9 | head -c256`)"
fi fi
echo "$user:$pass" | chpasswd $chpasswdParams echo "$user:$pass" | chpasswd $chpasswdParams
# if [ -f /home/$user/.ssh/authorized_keys ]; then
# chown -R $user:users /home/$user/.ssh
# chmod 400 /home/$user/.ssh/authorized_keys
# fi
done done
cd /public_keys
for user in *; do
if id -u $user >/dev/null 2>&1; then
mkdir -p /home/$user/.ssh
cp $user /home/$user/.ssh/authorized_keys
chown $user:users /home/$user/.ssh/authorized_keys
fi
done
cd /root
exec /usr/sbin/sshd -D exec /usr/sbin/sshd -D