Skip to content

Latest commit

 

History

History
71 lines (52 loc) · 2.32 KB

README.md

File metadata and controls

71 lines (52 loc) · 2.32 KB

ubuntu-sshd

Dockerized SSH service, built on top of official Ubuntu images.

Image tags

  • seth0r/ubuntu-sshd:12.04 (precise)
  • seth0r/ubuntu-sshd:14.04 (trusty)
  • seth0r/ubuntu-sshd:16.04 (xenial)
  • seth0r/ubuntu-sshd:18.04 (bionic)
  • seth0r/ubuntu-sshd:20.04 (focal)

Installed packages

Base:

Image specific:

Config:

  • PermitRootLogin yes
  • UsePAM no
  • exposed port 22
  • default command: /usr/sbin/sshd -D
  • root password: root

Persistence:

  • /home, /etc and /root can be external volumes
  • if /etc/passwd does not exist, initial contents from image are copied
  • if /root/.profile does not exist, initial contens from image are copied
  • all packages are upgraded at each container startup
  • packages listed in /etc/apt.install will be installed
  • packages listed in /etc/apt.remove will be removed
  • /etc/run.sh is executed at container start, if it exists

Run example

$ sudo docker run -d -P --name test_sshd rastasheep/ubuntu-sshd:14.04
$ sudo docker port test_sshd 22
  0.0.0.0:49154

$ ssh root@localhost -p 49154
# The password is `root`
root@test_sshd $

Security

If you are making the container accessible from the internet you'll probably want to secure it bit. You can do one of the following two things after launching the container:

  • Change the root password: docker exec -ti test_sshd passwd
  • Don't allow passwords at all, use keys instead:
$ docker exec test_sshd passwd -d root
$ docker cp file_on_host_with_allowed_public_keys test_sshd:/root/.ssh/authorized_keys
$ docker exec test_sshd chown root:root /root/.ssh/authorized_keys

Issues

If you run into any problems with this image, please check (and potentially file new) issues on the rastasheep/ubuntu-sshd repo, which is the source for this image.