Spaces:
Paused
Paused
BinaryONe
commited on
Commit
·
cb46931
1
Parent(s):
db27f7e
Changes
Browse files- Dockerfile +16 -3
- start.sh +2 -2
Dockerfile
CHANGED
|
@@ -17,10 +17,21 @@ RUN apt-get update && \
|
|
| 17 |
rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
# Create the 'admin' user with home directory and password, and 'administrator' group
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
RUN useradd -m -s /bin/bash admin && \
|
| 21 |
-
echo 'admin:password' | chpasswd
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
# Copy the application code to the container
|
|
@@ -65,6 +76,8 @@ RUN python3 -m venv /app/WebSSHEnv && \
|
|
| 65 |
/app/WebSSHEnv/bin/pip install --no-cache-dir webssh && \
|
| 66 |
/app/WebSSHEnv/bin/pip list
|
| 67 |
|
|
|
|
|
|
|
| 68 |
|
| 69 |
# Set working directory
|
| 70 |
WORKDIR /app
|
|
|
|
| 17 |
rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
# Create the 'admin' user with home directory and password, and 'administrator' group
|
| 20 |
+
#RUN useradd -m -s /bin/bash admin && \
|
| 21 |
+
# echo 'admin:password' | chpasswd && \
|
| 22 |
+
# useradd -m -s /bin/bash ubuntu && \
|
| 23 |
+
# echo 'ubuntu:password' | chpasswd && \
|
| 24 |
+
# groupadd administrator && \
|
| 25 |
+
# usermod -aG administrator,sudo admin && \
|
| 26 |
+
# usermod -aG administrator,sudo ubuntu
|
| 27 |
+
|
| 28 |
+
# Create the 'admin' and 'ubuntu' users with home directories and passwords, and add them to the 'sudo' group
|
| 29 |
RUN useradd -m -s /bin/bash admin && \
|
| 30 |
+
echo 'admin:password' | chpasswd && \
|
| 31 |
+
useradd -m -s /bin/bash ubuntu && \
|
| 32 |
+
echo 'ubuntu:password' | chpasswd && \
|
| 33 |
+
usermod -aG sudo admin && \
|
| 34 |
+
usermod -aG sudo ubuntu
|
| 35 |
|
| 36 |
|
| 37 |
# Copy the application code to the container
|
|
|
|
| 76 |
/app/WebSSHEnv/bin/pip install --no-cache-dir webssh && \
|
| 77 |
/app/WebSSHEnv/bin/pip list
|
| 78 |
|
| 79 |
+
# Change ownership of /home/admin directory
|
| 80 |
+
RUN chown -R admin:admin /home/admin
|
| 81 |
|
| 82 |
# Set working directory
|
| 83 |
WORKDIR /app
|
start.sh
CHANGED
|
@@ -24,8 +24,8 @@ fi
|
|
| 24 |
|
| 25 |
# Check if 'admin' user exists, create if missing
|
| 26 |
if ! id -u admin >/dev/null 2>&1; then
|
| 27 |
-
echo "* Creating
|
| 28 |
-
useradd -m -s /bin/bash -G sudo
|
| 29 |
echo "admin:password" | chpasswd
|
| 30 |
echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
| 31 |
fi
|
|
|
|
| 24 |
|
| 25 |
# Check if 'admin' user exists, create if missing
|
| 26 |
if ! id -u admin >/dev/null 2>&1; then
|
| 27 |
+
echo "* Creating $(whoami) user *"
|
| 28 |
+
useradd -m -s /bin/bash -G sudo $(whoami)
|
| 29 |
echo "admin:password" | chpasswd
|
| 30 |
echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
| 31 |
fi
|