File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -24,12 +24,35 @@ if ! command -v node &> /dev/null; then
2424 apt-get install -y nodejs
2525fi
2626
27+
28+
29+
30+
31+ # Create the new user
32+ echo " Creating user $SERVICE_USER ..."
33+
2734# Create service user if not exists
2835if ! id " $SERVICE_USER " & > /dev/null; then
2936 useradd -r -s /bin/false $SERVICE_USER
3037fi
3138
3239
40+ # Add the user to the sudo group
41+ echo " Adding $SERVICE_USER to the sudo group..."
42+ usermod -aG sudo " $SERVICE_USER "
43+
44+ # Verify the user belongs to the sudo group
45+ echo " Verifying sudo access for $SERVICE_USER ..."
46+ groups " $SERVICE_USER " | grep -q " sudo" && echo " $SERVICE_USER has been added to the sudo group." || echo " Failed to add $SERVICE_USER to the sudo group."
47+
48+ # Test sudo access (optional)
49+ echo " Testing sudo access for $SERVICE_USER ..."
50+ su - " $SERVICE_USER " -c " sudo whoami"
51+
52+ echo " User $SERVICE_USER has been created and granted sudo privileges."
53+
54+
55+
3356chown -R $SERVICE_USER :$SERVICE_USER $PROJECT_DIR
3457
3558# Install dependencies
You can’t perform that action at this time.
0 commit comments