https://github.com/meibraransari/ubuntu-ssh-enabled
๐ป Unlock the power of SSH with this Ubuntu image, perfect for testing and development! ๐ ๏ธ
https://github.com/meibraransari/ubuntu-ssh-enabled
ssh-server ubuntu ubuntu-server
Last synced: 3 months ago
JSON representation
๐ป Unlock the power of SSH with this Ubuntu image, perfect for testing and development! ๐ ๏ธ
- Host: GitHub
- URL: https://github.com/meibraransari/ubuntu-ssh-enabled
- Owner: meibraransari
- Created: 2024-05-21T11:57:42.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-31T10:58:40.000Z (almost 2 years ago)
- Last Synced: 2025-05-30T08:45:21.865Z (about 1 year ago)
- Topics: ssh-server, ubuntu, ubuntu-server
- Homepage:
- Size: 137 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
---
Created: 2024-07-27T14:01:27+05:30
Updated: 2024-07-31T16:28:10+05:30
Maintainer: Ibrar Ansari
---
๐ข๐ข๐ข Attention all Docker ๐ณ Beginners & Professionals! ๐ฏ
# ๐ป Unlock the power of SSH with this Ubuntu image, perfect for testing and development! ๐ ๏ธ
## ๐จ Please note: This image is designed for educational and testing purposes ๐ ๐งช ONLY! It is NOT SUITABLE for production environments! ๐ซ
This Docker image is built on Ubuntu 22.04 and comes pre-installed with an SSH server, enabling seamless creation of SSH-accessible containers. You can effortlessly configure access using SSH keys or by utilizing a default username and password.
## Step 1: Create Authentication SSH-Keygen Keys.
```
ssh-keygen -t rsa -f ~/.ssh/ansible_id_rsa_key -b 4096 -C "This is used for ansible" -N ""
ls -alsh ~/.ssh/
```
## Step 2: Pull docker image
```
docker pull ibraransaridocker/ubuntu-ssh-enabled:latest
```
## Step 3: Set variables to run the docker container.
### Change ๐ variables(containername, username, password & port) according to your need.
```
container_name=server_1
ssh_user=ibrar_ansari
ssh_pass=your_secure_password
ssh_port=2023
container_image=ibraransaridocker/ubuntu-ssh-enabled:latest
key_path=~/.ssh/ansible_id_rsa_key.pub
```
## Step 4: Run docker container.
```
docker run -itd --name=$container_name -p $ssh_port:22 -e SSH_USERNAME=$ssh_user -e PASSWORD=$ssh_pass -e AUTHORIZED_KEYS="$(cat $key_path)" $container_image
```
## Step 5: Test SSH connection
### Get Node IP:
```
hostname=$(hostname -I | awk '{print $1}')
```
### Pem Key Method:
```
ssh -i ~/.ssh/ansible_id_rsa_key -p $ssh_port $ssh_user@$hostname
```
### Password Method:
```
ssh -p $ssh_port $ssh_user@$hostname
```
### ๐ผ Connect with me ๐๐ ๐
- ๐ฅ [**Youtube**](https://www.youtube.com/@DevOpsinAction?sub_confirmation=1)
- โ [**Blog**](https://ibraransari.blogspot.com/)
- ๐ผ [**LinkedIn**](https://www.linkedin.com/in/ansariibrar/)
- ๐จโ๐ป [**Github**](https://github.com/meibraransari?tab=repositories)
- ๐ฌ [**Telegram**](https://t.me/DevOpsinActionTelegram)
- ๐ณ [**Docker**](https://hub.docker.com/u/ibraransaridocker)