mirror of
https://gitpot.dev/LogolicusZ/user-management.git
synced 2024-11-21 18:12:40 +00:00
New changes and Files
This commit is contained in:
commit
ef9e477532
7 changed files with 57 additions and 0 deletions
BIN
.DS_Store
vendored
Normal file
BIN
.DS_Store
vendored
Normal file
Binary file not shown.
BIN
M122_Vorlage_Anforderung_V1.0 .pdf
Normal file
BIN
M122_Vorlage_Anforderung_V1.0 .pdf
Normal file
Binary file not shown.
1
README.md
Normal file
1
README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
This is the Repository for the User Managment Project of the Modul M122
|
6
config.cfg
Normal file
6
config.cfg
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# Configuration for User Management Script
|
||||||
|
|
||||||
|
# Set options for processing
|
||||||
|
export OPTION_1="value1"
|
||||||
|
export OPTION_2="value2"
|
||||||
|
export OPTION_3="value3"
|
10
output.txt
Normal file
10
output.txt
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
User username has been created successfully.
|
||||||
|
User john123 has been created successfully.
|
||||||
|
User jane456 has been created successfully.
|
||||||
|
User alice123 has been created successfully.
|
||||||
|
User bob456 has been created successfully.
|
||||||
|
User johndoe has been created successfully.
|
||||||
|
User janedoe has been created successfully.
|
||||||
|
User user1 has been created successfully.
|
||||||
|
User user2 has been created successfully.
|
||||||
|
User user3 has been created successfully.
|
30
user_management.sh
Executable file
30
user_management.sh
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Step 1: Set Configuration using Environment Variables
|
||||||
|
source config.cfg
|
||||||
|
|
||||||
|
# Step 2: Retrieve User Data from a CSV File
|
||||||
|
while IFS=',' read -r username password email
|
||||||
|
do
|
||||||
|
# Step 3: Process User Data
|
||||||
|
# Create a new user
|
||||||
|
sudo dscl . -create "/Users/$username"
|
||||||
|
sudo dscl . -create "/Users/$username" UserShell "/bin/bash"
|
||||||
|
sudo dscl . -create "/Users/$username" RealName "$username"
|
||||||
|
sudo dscl . -create "/Users/$username" UniqueID "<userID>"
|
||||||
|
sudo dscl . -create "/Users/$username" PrimaryGroupID "<groupID>"
|
||||||
|
sudo dscl . -create "/Users/$username" NFSHomeDirectory "/Users/$username"
|
||||||
|
sudo dscl . -passwd "/Users/$username" "$password"
|
||||||
|
sudo dscl . -append /Groups/admin GroupMembership "$username"
|
||||||
|
|
||||||
|
# Step 4: Provide Additional Details to the User
|
||||||
|
echo "Welcome, $username! Here are some additional details." > "/Users/$username/details.txt"
|
||||||
|
# Include more information as needed
|
||||||
|
|
||||||
|
# Step 5: Create Output File
|
||||||
|
echo "User $username has been created successfully." >> output.txt
|
||||||
|
|
||||||
|
done < userdata.csv
|
||||||
|
|
||||||
|
# Step 6: Add Cronjob
|
||||||
|
echo "0 8 * * 0 /path/to/script.sh" | crontab -
|
10
userdata.csv
Normal file
10
userdata.csv
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
username,password,email
|
||||||
|
john123,pass123,john@example.com
|
||||||
|
jane456,pass456,jane@example.com
|
||||||
|
alice123,alicepass123,alice@example.com
|
||||||
|
bob456,bobpass456,bob@example.com
|
||||||
|
johndoe,password123,johndoe@example.com
|
||||||
|
janedoe,securepass789,janedoe@example.com
|
||||||
|
user1,pass123,user1@example.com
|
||||||
|
user2,pass456,user2@example.com
|
||||||
|
user3,pass789,user3@example.com
|
|
Loading…
Reference in a new issue