Created
March 14, 2025 14:24
-
-
Save lovemycodesnippets/e8933a6ca1f5531e4a23a3b1963db3c8 to your computer and use it in GitHub Desktop.
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 | |
# Define the length of the password | |
LENGTH=16 | |
# Generate strong and complex passwords using pwgen | |
for i in {1..5}; do | |
PASSWD=$(pwgen -s $LENGTH) | |
echo "Password $i: $PASSWD" | |
done | |
# Use specific character sets with pwgen | |
echo "" | |
echo "Using lowercase letters only:" | |
for i in {1..2}; do | |
PASSWD=$(pwgen -l $LENGTH) | |
echo "Password$i:$PASSWD" | |
done | |
echo "" | |
echo "Using numbers and special characters:" | |
for i in {1..3}; do | |
PASSWD=$(pwgen -c $LENGTH) | |
echo "Password$i:$PASSWD" | |
done | |
# Use uppercase letters only with pwgen | |
echo "" | |
echo "Using uppercase letters only:" | |
for i in {1..2}; do | |
PASSWD=$(pwgen -u $LENGTH) | |
echo "Password$i:$PASSWD" | |
done | |
# Use a combination of characters with pwgen | |
echo "" | |
echo "Using a combination of lowercase and numbers:" | |
for i in {1..3}; do | |
PASSWD=$(pwgen -l --numeric-$LENGTH) | |
echo "Password$i:$PASSWD" | |
done | |
# Use a custom character set with pwgen | |
echo "" | |
echo "Using the following custom characters: !@#$%^&*()_-=+{}[]|;:,.<>?/~`" | |
for i in {1..2}; do | |
PASSWD=$(pwgen -c --custom-charset "!@#$%^&*()_-=+{}[]|;:,.<>?/~`" $LENGTH) | |
echo "Password$i:$PASSWD" | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment