| schillinge | 9622199 | 2019-03-14 22:41:52 +0100 | [diff] [blame] | 1 | # Copyright (c) 2019 Erik Schilling |
| 2 | # ALL RIGHTS RESERVED. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | # based on https://docs.docker.com/engine/examples/running_ssh_service/ |
| 17 | FROM ubuntu:16.04 |
| 18 | |
| 19 | RUN apt update && apt install -y net-tools iproute |
| 20 | RUN apt install -y openssh-server |
| 21 | RUN mkdir /var/run/sshd |
| 22 | RUN echo 'root:test' | chpasswd |
| 23 | RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config |
| 24 | |
| 25 | # SSH login fix. Otherwise user is kicked off after login |
| 26 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd |
| 27 | |
| 28 | ENV NOTVISIBLE "in users profile" |
| 29 | RUN echo "export VISIBLE=now" >> /etc/profile |
| 30 | |
| 31 | EXPOSE 22 |
| 32 | |
| 33 | CMD ["/usr/sbin/sshd", "-D"] |