Init: SSH docker for hosting
This commit is contained in:
commit
ecab42144a
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
FROM registry.sindominio.net/debian
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y openssh-server
|
||||||
|
|
||||||
|
RUN mkdir /var/run/sshd
|
||||||
|
|
||||||
|
COPY sshd_config /etc/ssh/sshd_config
|
||||||
|
|
||||||
|
ADD entrypoint.sh /
|
||||||
|
ADD start.sh /
|
||||||
|
|
||||||
|
VOLUME /home/user/httpdocs
|
||||||
|
|
||||||
|
EXPOSE 22
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/bin/sh", "/entrypoint.sh" ]
|
||||||
|
CMD ["/bin/sh", "/start.sh"]
|
12
docker-compose.yml
Normal file
12
docker-compose.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
ssh:
|
||||||
|
build: .
|
||||||
|
environment:
|
||||||
|
SSH_USER: user
|
||||||
|
SSH_PASS: pass
|
||||||
|
ports:
|
||||||
|
- "0.0.0.0:2133:22"
|
||||||
|
volumes:
|
||||||
|
- ./data:/home/user/httpdocs
|
||||||
|
restart: always
|
11
entrypoint.sh
Normal file
11
entrypoint.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e;
|
||||||
|
|
||||||
|
echo $SSH_USER:$SSH_PASS
|
||||||
|
if [ -z `getent passwd $SSH_USER` ]; then useradd $SSH_USER -d /home/user; fi
|
||||||
|
echo "$SSH_USER:$SSH_PASS" | chpasswd
|
||||||
|
|
||||||
|
#echo "/bin/false" | tee -a /etc/shells
|
||||||
|
usermod $SSH_USER -s /bin/false
|
||||||
|
|
||||||
|
exec $@
|
10
sshd_config
Normal file
10
sshd_config
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Port 22
|
||||||
|
ChallengeResponseAuthentication no
|
||||||
|
UsePAM yes
|
||||||
|
X11Forwarding no
|
||||||
|
PrintMotd no
|
||||||
|
AcceptEnv LANG LC_*
|
||||||
|
Subsystem sftp internal-sftp
|
||||||
|
ForceCommand internal-sftp
|
||||||
|
ChrootDirectory %h
|
||||||
|
AllowTcpForwarding no
|
Loading…
Reference in New Issue
Block a user