all InfoSec News
Optimizing My Company's Developers and Group Management with Bash Script Automation
July 3, 2024, 11:24 a.m. | Abdul Barri Lawal
DEV Community dev.to
Bash Script: create_users.sh
#!/bin/bash
# Log file and password file paths
LOG_FILE="/var/log/user_management.log"
PASSWORD_FILE="/var/secure/user_passwords.csv"
# Function to log actions
log_action() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> $LOG_FILE
}
# Function to generate random passwords
generate_password() {
openssl rand -base64 12
}
# Check if the input file is provided
if [ $# -ne 1 ]; then
echo "Usage: $0 <name-of-text-file>"
exit 1
fi
# Create log and password files
touch $LOG_FILE
mkdir -p /var/secure
touch $PASSWORD_FILE
chmod …
actions automation base64 bash bash script check csv date developers echo file function input log management openssl password passwords rand random script var
More from dev.to / DEV Community
Jobs in InfoSec / Cybersecurity
Project Manager – Core Financial
@ Proofpoint | Draper, UT
Recruiting Coordinator
@ Proofpoint | Sunnyvale, CA
Director of IT Governance, Risk & Control
@ Bupa | Central London
Director
@ PwC | Bengaluru Millenia
Senior Manager
@ PwC | Mumbai Shivaji Park
Senior Manager
@ PwC | Bengaluru Millenia