Fix sshd_config echo: use \n literals not newlines
This commit is contained in:
10
Dockerfile
10
Dockerfile
@@ -50,6 +50,8 @@ RUN mkdir -p /var/run/sshd && \
|
|||||||
chmod 775 /var/run/sshd
|
chmod 775 /var/run/sshd
|
||||||
|
|
||||||
# Custom sshd_config for non-root usage
|
# Custom sshd_config for non-root usage
|
||||||
|
# StrictModes no: Required for non-root / random UID environments
|
||||||
|
# PidFile: Point to /tmp for guaranteed write access
|
||||||
RUN echo "Port 2222
|
RUN echo "Port 2222
|
||||||
PermitRootLogin no
|
PermitRootLogin no
|
||||||
PasswordAuthentication no
|
PasswordAuthentication no
|
||||||
@@ -70,13 +72,21 @@ RUN useradd -m -s /bin/bash -u 1000 claw && \
|
|||||||
chmod -R g+rwX /home/claw
|
chmod -R g+rwX /home/claw
|
||||||
|
|
||||||
# Prepare volume mount point
|
# Prepare volume mount point
|
||||||
|
# Mount persistent storage here
|
||||||
VOLUME /data
|
VOLUME /data
|
||||||
RUN mkdir -p /data && \
|
RUN mkdir -p /data && \
|
||||||
chown claw:claw /data && \
|
chown claw:claw /data && \
|
||||||
chmod 775 /data
|
chmod 775 /data
|
||||||
|
|
||||||
|
# Set working directory to the persistent volume
|
||||||
WORKDIR /data
|
WORKDIR /data
|
||||||
|
|
||||||
|
# Expose SSH port (non-privileged)
|
||||||
EXPOSE 2222
|
EXPOSE 2222
|
||||||
|
|
||||||
|
# Switch to user 'claw' (UID 1000)
|
||||||
USER claw
|
USER claw
|
||||||
|
|
||||||
|
# Start SSH daemon
|
||||||
|
# Fix: StrictModes no handles permissions, but chmod 600 helps sanity.
|
||||||
CMD ["/bin/bash", "-c", "mkdir -p /data/ssh && if [ ! -f /data/ssh/ssh_host_rsa_key ]; then echo 'Generating persistent host keys...'; ssh-keygen -f /data/ssh/ssh_host_rsa_key -N '' -t rsa; ssh-keygen -f /data/ssh/ssh_host_ecdsa_key -N '' -t ecdsa; ssh-keygen -f /data/ssh/ssh_host_ed25519_key -N '' -t ed25519; fi && chmod 600 /data/ssh/ssh_host_*_key && /usr/sbin/sshd -D -f /etc/ssh/sshd_config"]
|
CMD ["/bin/bash", "-c", "mkdir -p /data/ssh && if [ ! -f /data/ssh/ssh_host_rsa_key ]; then echo 'Generating persistent host keys...'; ssh-keygen -f /data/ssh/ssh_host_rsa_key -N '' -t rsa; ssh-keygen -f /data/ssh/ssh_host_ecdsa_key -N '' -t ecdsa; ssh-keygen -f /data/ssh/ssh_host_ed25519_key -N '' -t ed25519; fi && chmod 600 /data/ssh/ssh_host_*_key && /usr/sbin/sshd -D -f /etc/ssh/sshd_config"]
|
||||||
|
|||||||
Reference in New Issue
Block a user