File size: 559 Bytes
7452af2
a158cbd
6633832
7452af2
6633832
a158cbd
6633832
7452af2
6633832
a158cbd
7452af2
68872e1
 
7452af2
 
a158cbd
b2c7186
 
 
6633832
a158cbd
6633832
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
FROM ubuntu:20.04

# Update and install necessary packages
RUN apt-get update && \
    apt-get install -y curl

# Create a new user
RUN useradd -m -s /bin/bash user && \
    echo "user:user" | chpasswd

# Switch to the new user
USER user

# Set the working directory
WORKDIR /home/user

# Add a script with the correct shebang
RUN echo -e '#!/bin/bash\n' > /home/user/test.sh && \
    echo 'echo "user" | su -c "echo Sudo is not working but su is!"' >> /home/user/test.sh && \
    chmod +x /home/user/test.sh

# Run the test script
CMD ["/home/user/test.sh"]