This repository contains a Docker setup for creating a custom SSH server based on Alpine Linux.
10K+
This repository contains a Docker setup for creating a custom SSH server based on Alpine Linux. The setup includes the ability to use static SSH host keys, configure SSH key and password authentication, and set up user-specific SSH key pairs.
This project provides a Dockerized environment for creating a custom SSH server with the following features:
Before you begin, ensure you have the following installed:
Clone the Repository:
Clone this repository to your local machine:
git clone https://github.com/haravich/custom-ssh-server.git
cd custom-ssh-server
Customize Configuration:
Modify the setup-ssh-user.sh script to customize user creation and SSH key settings. Place your public key in the ssh-keys directory (needed). Customize the sshd_config file to adjust SSH server settings.
Build and Run:
Build the Docker image and run the container:
docker build -t custom-ssh-server .
docker run -d -p 2222:22 -e SSH_USER=<desired_username> -e SSH_PASSWORD=<desired_password> haravich/custom-ssh-server
(or)
docker run -d -p 2222:22 -e SSH_USER=<desired_username> -e SSH_PUBLIC_KEY="<value_of_public_key> || $(cat /ssh-keys/*.pub)" haravich/custom-ssh-server
(or)
docker run -d -p 2222:22 -e SSH_USER=<desired_username> -e SSH_PASSWORD=<desired_password> -e SSH_PUBLIC_KEY="<value_of_public_key> | $(cat /ssh-keys/*.pub)" haravich/custom-ssh-server
Replace <desired_username> and <desired_password> with appropriate values.
To connect to the SSH server:
ssh -i /path/to/private_key_file -p 2222 <desired_username>@localhost
Replace /path/to/private_key_file and <desired_username> with appropriate values.
This project is licensed under the MIT License. See the LICENSE.md file for details.
Copy and paste this Markdown content into a file named README.md in the root of your repository. Feel free to adjust the formatting and content as needed for your project.
Content type
Image
Digest
sha256:6d6c5d7d9…
Size
9.7 MB
Last updated
4 days ago
docker pull haravich/custom-ssh-server