Sign inSign up

comanderanch/my_ssh_image

By comanderanch

Updated over 1 year ago

Image
0

130

comanderanch/my_ssh_image repository overview

ssh image ssh admin@host-ip -p 2223 PW admin

docker pull comanderanch/my_ssh_image:latest

the ssh image:latest was the first build and created from this docker file

FROM ubuntu:latest

Install OpenSSH server

RUN apt-get update && apt-get install -y openssh-server sudo

Create a user 'admin' and set the password to 'admin'

RUN useradd -m admin && echo "admin:admin" | chpasswd

Give the 'admin' user sudo privileges (optional, if needed)

RUN usermod -aG sudo admin

Create the necessary directory for SSH service

RUN mkdir -p /run/sshd

Expose port 22 for SSH

EXPOSE 22

Set the default command to start the SSH service

CMD ["/usr/sbin/sshd", "-D"]

and the image :v2 was built from the following docker file please forgive me if all the docs and how to actualy use the images i am still learning and chat gpt is pretty stupid somtimes no matter how many times you ask for info and help with code or docker help it is always only going to be a typewrighter that knows how to make tost!

this is the second :v2 image that was meant to be part of an game i was trying to build with using my website the ssh container was made to accept ssh and i was going to use my custom code server image to have web terminal and ide so that when i conect it to a cloud flare tunel the codeserver could ssh into the container and create multiple containers with a scrip that would be sent from my webpage and rerout trafick to the link for the ssh/code server instances this way each user could have there ide terminal and a container with calenges setup to be played out in the browser i had planed to use the anonimuse theam " and please forgive my spelling that is why i use gpt" to creat a hack game where the user had the ide and terminal that they could use as there hack station so if they had to write code to beat the chalenge they could do so but be in an isolated enviroment and feel like they were realy hacking a secure of site system but any how here is the Dockerfile for that only now i dont understand why i cant ssh to this one

FROM comanderanch/my_ssh_image:latest

Create the secret user

RUN useradd -m -s /bin/bash secretusr &&
echo "secretusr:yourpassword" | chpasswd &&
usermod -aG sudo secretusr

Set the prompt to something cool (like elite_hacker or secret_user)

RUN echo "export PS1='\[\033[01;32m\]elite_hacker@hack-shak:\w\$ \[\033[00m\]'" >> /home/secretusr/.bashrc

Set secretusr as the default user

USER secretusr

Run SSHD (or any service you need)

CMD ["/usr/sbin/sshd", "-D"]

docker run -it comanderanch/my_ssh_image:v2 /bin/bash

maybe one day when i learn more i will revisit this and try again also the code server image already has the compilers bunt to the image so that was going to be a plus and the ssh image has nano instaled as well

as I said i am just a beginner and dont know how to get the ssh into the second image even when i ran this

docker run -d -p 2225:22 --name charming_shannon comanderanch/my_ssh_image:v2 /usr/sbin/sshd -D

if i run the terminal to the first run for the image :v2 it works at terminal -it but when i atempt to ssh it refuses to conect

Tag summary

Content type

Image

Digest

sha256:b0abb462b

Size

125.4 MB

Last updated

over 1 year ago

docker pull comanderanch/my_ssh_image