0
0
Fork 0
mirror of https://github.com/atmoz/sftp.git synced 2025-03-09 15:16:00 -04:00

feat(sshd_config): let the sshd port to be changed using a env var

This commit is contained in:
FXHibon 2023-07-17 15:55:53 +02:00
parent eacf693131
commit da094d5b12
4 changed files with 9 additions and 2 deletions

View file

@ -1,6 +1,8 @@
FROM debian:bullseye
MAINTAINER Adrian Dvergsdal [atmoz.net]
ENV SSHD_PORT 22
# Steps done in one RUN layer:
# - Install packages
# - OpenSSH needs /var/run/sshd to run
@ -15,6 +17,4 @@ COPY files/sshd_config /etc/ssh/sshd_config
COPY files/create-sftp-user /usr/local/bin/
COPY files/entrypoint /
EXPOSE 22
ENTRYPOINT ["/entrypoint"]

View file

@ -30,6 +30,8 @@ Easy to use SFTP ([SSH File Transfer Protocol](https://en.wikipedia.org/wiki/SSH
own home directory, so make sure there are at least one subdirectory if you
want them to upload files.
- For consistent server fingerprint, mount your own host keys (i.e. `/etc/ssh/ssh_host_*`)
- Override port
- The container will listen on the port 22 (default for sshd), but if for any reasons you want an another port to be used instead of the default, you can change it with the env var SSHD_PORT
# Examples

View file

@ -90,6 +90,9 @@ if [ -d /etc/sftp.d ]; then
unset f
fi
sed -i "s/SSHD_PORT/$SSHD_PORT/" /etc/ssh/sshd_config
if $startSshd; then
log "Executing sshd"
exec /usr/sbin/sshd -D -e

View file

@ -20,3 +20,5 @@ ChrootDirectory %h
# Enable this for more logs
#LogLevel VERBOSE
Port SSHD_PORT