Skip to content

Instantly share code, notes, and snippets.

@numpde
Last active October 8, 2024 21:27
Show Gist options
  • Save numpde/41349ac0a295402a5171c3976b331651 to your computer and use it in GitHub Desktop.
Save numpde/41349ac0a295402a5171c3976b331651 to your computer and use it in GitHub Desktop.
WP/WC: Create wc user
#!/bin/bash
# How to run:
# curl -s https://gist.githubusercontent.com/numpde/41349ac0a295402a5171c3976b331651/raw | bash -s "PASSWORD"
# Check if the password is provided
if [ $# -ne 1 ]; then
echo "Usage: $0 <password>"
exit 1
fi
USERNAME="wc"
PASSWORD=$1
# Create the user without a password prompt
sudo useradd -m -s /bin/bash $USERNAME
# Set the user's password
echo "$USERNAME:$PASSWORD" | sudo chpasswd
# Add the user to the Docker group
sudo usermod -aG docker $USERNAME
# Print success message
echo "User $USERNAME created and added to the Docker group successfully."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment