The prepared configuration for running OpenSSH server with expose port on a host.
-
Clone the repo to your location:
$> git clone https://github.com/cardinalit/docker-openssh-server.git $> cd docker-openssh-server/
-
You can run the command below:
$> ./jumphost-up.sh
If the command was successful, you will see the following result:
NOTE
When you run it again, the script will not overwrite existing files in the system :)
-
You should add your or another user public key to
sshd/data/.ssh/authorized_keys
:3.1 Your PC:
$> cat ~/.ssh/*.pub
3.2 Remote host or local:
$> echo 'ssh-rsa .......... user@PC' >> sshd/data/.ssh/authorized_keys
-
After you can connect to your OpenSSH server:
$> ssh -p 32222 devops@localhost
-
Enjoy!
Example on a local machine:
⠀• Docker version: Docker version 19.03.13, build 4484c46d9d
⠀• OS: macOS Big Sur version 11.0.1