Sign inSign up

rodger753/ssh_ubuntu

By rodger753

Updated over 4 years ago

Image
0

63

rodger753/ssh_ubuntu repository overview

Details

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.

DOCKERFILE
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"]
BUILD
docker build -t rodger753/ssh_ubuntu:64bits .
CREATE

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
Changing the password for users root and support

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
ACCESS

docker exec -it ubuntu_ssh bash

PUSH

docker push rodger753/ssh_ubuntu:64bits

Tag summary

Content type

Image

Digest

Size

91.5 MB

Last updated

over 4 years ago

docker pull rodger753/ssh_ubuntu:64bits