mirror of
https://github.com/atmoz/sftp.git
synced 2024-11-17 12:51:33 -05:00
First commit
This commit is contained in:
commit
c25801daad
4 changed files with 45 additions and 0 deletions
1
.dockerignore
Normal file
1
.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
.git
|
15
Dockerfile
Normal file
15
Dockerfile
Normal file
|
@ -0,0 +1,15 @@
|
|||
FROM debian:wheezy
|
||||
MAINTAINER Adrian Dvergsdal
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssh-server
|
||||
|
||||
RUN mkdir -p /var/run/sshd
|
||||
RUN addgroup --system sftp
|
||||
|
||||
ADD . /root
|
||||
WORKDIR /root
|
||||
RUN mv sshd_config /etc/ssh/sshd_config
|
||||
|
||||
EXPOSE 22
|
||||
|
||||
CMD ["/bin/bash", "run"]
|
18
run
Normal file
18
run
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Add users
|
||||
IFS=',' read -a users <<< "$SFTP_USERS"
|
||||
for userData in "${users[@]}"; do
|
||||
IFS=':' read -a data <<< "$userData"
|
||||
user="${data[0]}"
|
||||
pass="${data[1]}"
|
||||
|
||||
useradd -G sftp $user
|
||||
echo "$user:$pass" | chpasswd
|
||||
chown root:root /home/$user
|
||||
chmod 755 /home/$user
|
||||
chown -R $user:sftp /home/$user/*
|
||||
done
|
||||
|
||||
# Run SSH
|
||||
/usr/sbin/sshd -D
|
11
sshd_config
Normal file
11
sshd_config
Normal file
|
@ -0,0 +1,11 @@
|
|||
PermitRootLogin no
|
||||
#ChallengeResponseAuthentication no
|
||||
UsePAM no
|
||||
Subsystem sftp internal-sftp
|
||||
|
||||
Match group sftp
|
||||
ChrootDirectory %h
|
||||
X11Forwarding no
|
||||
AllowTcpForwarding no
|
||||
ForceCommand internal-sftp
|
||||
|
Loading…
Reference in a new issue