The reason behind the creation of this container is to provide someone else SSH access to a server while protecting the file system of the main server. The SSH user default password is going to be user root and password root and it will also contain a basic user support with password root.
FROM ubuntu:latest
RUN apt update && apt install openssh-server sudo -y
RUN sed -ri 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
RUN useradd -rm -d /home/ubuntu -s /bin/bash -u 1000 support
RUN echo 'support:root' | chpasswd
RUN echo 'root:root' | chpasswd
RUN service ssh start
EXPOSE 22
WORKDIR /opt/files/
CMD ["/usr/sbin/sshd","-D"]
docker build -t rodger753/ssh_ubuntu:64bits .
In this example we will be mapping port 22 to port 2222, so we should be able to access the container using port 2222 and the hosts ip address.
docker run \
-d \
-it \
-p 2222:22 \
--name ssh_ubuntu \
-v /yourshared/files/:/opt/files/ \
rodger753/ssh_ubuntu:64bits
in this example we will be changing the default password root to root12345
docker exec -it ubuntu_ssh bash
echo 'support:root12345' | chpasswd
echo 'root:root12345' | chpasswd
docker exec -it ubuntu_ssh bash
docker push rodger753/ssh_ubuntu:64bits
Content type
Image
Digest
Size
91.5 MB
Last updated
over 4 years ago
docker pull rodger753/ssh_ubuntu:64bits