Skip to content

Commit eb18050

Browse files
committed
Use root user on container to avoid problems with SSH key read permissions or mapping on privileged ports
1 parent 1adf68b commit eb18050

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

Dockerfile

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
FROM python:3-slim-buster
22

3-
ARG USERNAME=user
43
ENV MAPPINGS="" \
54
SSH_USER="" \
65
SSH_HOST="" \
@@ -14,10 +13,6 @@ RUN apt-get -yq update && \
1413
apt-get -yq install autossh && \
1514
rm -rf /var/lib/apt/lists/*
1615

17-
RUN useradd -ms /bin/bash $USERNAME
18-
USER $USERNAME
19-
WORKDIR /home/$USERNAME
20-
21-
COPY entrypoint.py ./
16+
COPY entrypoint.py /
2217

2318
CMD ["python", "-u", "entrypoint.py"]

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Mapping examples:
4747
- `80`: forward port 80 from remote host (where SSH server is running) to port 80 of local container
4848
- `192.168.0.200:80`: forward port 80 from the host 192.168.0.200 (visible by the SSH server) to port 80 of local container
4949
- `8080:127.0.0.1:80`: forward port 80 from remote host (where SSH server is running) to port 8080 of local container
50-
- `127.0.0.1:80:127.0.0.1:80`: forward port 80 from remote host (where SSH server is running) to port 80 of local container, and only accesible by the container itself (not a common behaviour...)
50+
- `127.0.0.1:80:127.0.0.1:80`: forward port 80 from remote host (where SSH server is running) to port 80 of local container, and only accesible by the container itself (or by the host, if network=host)
5151

5252
Multiple mappings can be defined splitting them by `;` (when running docker run, the value must be passed between quotes, like `-e MAPPINGS="8080:127.0.0.1:80"`)
5353

@@ -76,6 +76,7 @@ Reverse and non-reverse mappings can be combined on the same connection, thus, t
7676

7777
## Changelog
7878

79+
- 0.3.1: use root user on container to avoid problems with SSH key read permissions or mapping on privileged ports
7980
- 0.2.1: allow defining reverse port forwarding mappings
8081
- 0.1.1: add setting to enable compression
8182
- 0.0.1: initial release

0 commit comments

Comments
 (0)