File size: 519 Bytes
80db73d
45e3447
fbafdd6
 
1f55c17
dfd32bf
fbafdd6
 
dfd32bf
fbafdd6
 
87aacc5
5783142
fbafdd6
 
 
 
 
9ae4f84
fbafdd6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

# Get the username from the command line arguments
USERNAME=$1

# Check if the user already exists
if id "$USERNAME" >/dev/null 2>&1; then
    echo "User $USERNAME already exists."
else
    # Create the user with a home directory and a bash shell
    useradd -m -s /bin/bash "$USERNAME"
fi

# Set appropriate permissions for the application directory
chown -R "$USERNAME":"$USERNAME" /app
chmod -R 755 /app

# Switch to the user for improved security
su "$USERNAME" -c "exec /usr/local/bin/entrypoint.sh"