Last active
October 8, 2024 21:27
-
-
Save numpde/41349ac0a295402a5171c3976b331651 to your computer and use it in GitHub Desktop.
WP/WC: Create wc user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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