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:
parent
eacf693131
commit
da094d5b12
4 changed files with 9 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
||||||
FROM debian:bullseye
|
FROM debian:bullseye
|
||||||
MAINTAINER Adrian Dvergsdal [atmoz.net]
|
MAINTAINER Adrian Dvergsdal [atmoz.net]
|
||||||
|
|
||||||
|
ENV SSHD_PORT 22
|
||||||
|
|
||||||
# Steps done in one RUN layer:
|
# Steps done in one RUN layer:
|
||||||
# - Install packages
|
# - Install packages
|
||||||
# - OpenSSH needs /var/run/sshd to run
|
# - 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/create-sftp-user /usr/local/bin/
|
||||||
COPY files/entrypoint /
|
COPY files/entrypoint /
|
||||||
|
|
||||||
EXPOSE 22
|
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint"]
|
ENTRYPOINT ["/entrypoint"]
|
||||||
|
|
|
@ -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
|
own home directory, so make sure there are at least one subdirectory if you
|
||||||
want them to upload files.
|
want them to upload files.
|
||||||
- For consistent server fingerprint, mount your own host keys (i.e. `/etc/ssh/ssh_host_*`)
|
- 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
|
# Examples
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,9 @@ if [ -d /etc/sftp.d ]; then
|
||||||
unset f
|
unset f
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
sed -i "s/SSHD_PORT/$SSHD_PORT/" /etc/ssh/sshd_config
|
||||||
|
|
||||||
if $startSshd; then
|
if $startSshd; then
|
||||||
log "Executing sshd"
|
log "Executing sshd"
|
||||||
exec /usr/sbin/sshd -D -e
|
exec /usr/sbin/sshd -D -e
|
||||||
|
|
|
@ -20,3 +20,5 @@ ChrootDirectory %h
|
||||||
|
|
||||||
# Enable this for more logs
|
# Enable this for more logs
|
||||||
#LogLevel VERBOSE
|
#LogLevel VERBOSE
|
||||||
|
|
||||||
|
Port SSHD_PORT
|
||||||
|
|
Loading…
Add table
Reference in a new issue