-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.sshd
More file actions
42 lines (33 loc) · 1.66 KB
/
Copy pathDockerfile.sshd
File metadata and controls
42 lines (33 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
FROM ubuntu:14.10
LABEL maintainer="ZenEntropy <alain.pulluelo@forgerock.com>"
USER root
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y apt-utils \
&& apt-get install -y openssh-server \
&& apt-get install -y lsof \
&& apt-get install -y inetutils-ping \
&& apt-get install -y net-tools \
&& apt-get install -y sudo \
&& apt-get install -y vim \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /ball
# ----------------------------------------------------------------------------------------
# Setup sshd (set root password)
# ----------------------------------------------------------------------------------------
RUN echo root:toor | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
#RUN sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
RUN update-rc.d ssh defaults
EXPOSE 22
# ----------------------------------------------------------------------------------------
# prepare the startup command of the container
# ----------------------------------------------------------------------------------------
USER root
WORKDIR /root
RUN mkdir scripts
# ADD/COPY always run with root uid... even if USER is set to a different user :(
COPY launcher_sshd.sh scripts/
RUN chmod 0740 scripts/launcher_sshd.sh
# !! launcher_sshd.sh must be launched with root user !!
CMD ["/root/scripts/launcher_sshd.sh"]