Skip to content

3.0. Set up a remote host

Hints

If you already have a remote host which has a configured OpenSSH server, you can skip this step. (The following exercices will use password-based authentication, but the SSHLibrary supports key-based authentication, too.)

The prerequisite for the next steps is to have an already installed and configured Docker Engine.

We are going to use openssh-server container from LinuxServer.io team to quickly set up a limited and sandboxed environment that we can ssh into.

Create an openssh-server based container with to following command.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
docker create \
  --name=openssh-server-for-robot \
  --hostname=openssh-server-for-robot \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Europe/Budapest \
  -e SUDO_ACCESS=true \
  -e PASSWORD_ACCESS=true \
  -e USER_PASSWORD=Hn7c5%lyBpIn8*8Z \
  -e USER_NAME=robotdev \
  -p 2222:2222 \
  --restart unless-stopped \
  linuxserver/openssh-server

Check that your container is created.

1
docker container ls --all --filter "name=openssh-server-for-robot"
CONTAINER ID        IMAGE                        COMMAND             CREATED             STATUS              PORTS               NAMES
95313a9f85f1        linuxserver/openssh-server   "/init"             3 minutes ago       Created                                 openssh-server-for-robot

Start the container.

1
docker container start openssh-server-for-robot

Try to access it using ssh.

1
ssh robotdev@localhost -p 2222
The authenticity of host '[localhost]:2222 ([127.0.0.1]:2222)' can't be established.
ECDSA key fingerprint is SHA256:x4bTJ6bxYJEp4zMk9sQMYhK8ou8oQrm6aCsKaBnj+2o.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

You should see the following promt.

Welcome to OpenSSH Server

openssh-server-for-robot:~$

That is it, you are good to go!


Last update: June 22, 2020