clone3 commited on
Commit
cf09021
·
verified ·
1 Parent(s): c505f6f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -9
Dockerfile CHANGED
@@ -1,10 +1,26 @@
1
- FROM ubuntu:latest
2
- RUN apt-get update && apt-get install -y openssh-server
3
- # Configure SSH
4
- RUN mkdir /var/run/sshd
5
- RUN echo 'root:redhat' | chpasswd
6
- #password for user login
 
 
 
 
 
 
 
 
 
 
 
 
7
  RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
8
- EXPOSE 22
9
- # Start SSH server
10
- CMD ["/usr/sbin/sshd", "-D"]
 
 
 
 
 
1
+ # Use a base image with SSH support, like Ubuntu
2
+ FROM ubuntu:22.04
3
+
4
+ # Update package list and install necessary packages
5
+ RUN apt-get update && apt-get install -y \
6
+ openssh-server \
7
+ sudo \
8
+ curl \
9
+ vim \
10
+ net-tools \
11
+ && mkdir /var/run/sshd
12
+
13
+ # Create a new user and set a password (modify username and password as needed)
14
+ RUN useradd -rm -d /home/user -s /bin/bash -g root -G sudo -u 1000 user && \
15
+ echo 'user:user' | chpasswd && \
16
+ echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
17
+
18
+ # Allow root login and password authentication
19
  RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
20
+ RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
21
+
22
+ # Expose SSH port
23
+ EXPOSE 7860
24
+
25
+ # Start the SSH service when the container starts
26
+ CMD ["/usr/sbin/sshd", "-D"]