scripts/bash/addusers

28 lines
895 B
Plaintext
Raw Normal View History

2015-08-15 08:54:53 +02:00
#!/usr/bin/env bash
# Stupid script for adding users to family and friends after fresh
# installations. I am too lazy to always do this by hand!
# Loop with the users
2023-05-18 11:25:47 +02:00
for user in mikaela matti tommi tiina nenne anneli; do
2023-04-06 11:03:10 +02:00
# To see that it works
echo "Current user: $user"
# Create the user & homedir if it doesn't exist
useradd -m $user
# Add the user to normal Debian groups
usermod -a -G lp,cdrom,floppy,audio,dip,plugdev,netdev,bluetooth,lpadmin "$user"
# Set user & group as the owner (in case fresh install with old /home)
chown -R $user:$user /home/$user
# Remove password & force new to be given during first login
passwd -de $user
# Does this still work?
echo "User ready: $user"
2015-08-15 08:54:53 +02:00
done
# And next sudoers
2023-05-18 11:25:47 +02:00
for sudoer in mikaela matti tommi tiina; do
2023-04-06 11:03:10 +02:00
# Add the user to sudo group (as they are administrator)
echo "Current sudoer: $sudoer"
usermod -a -G wheel $sudoer
2015-08-15 08:54:53 +02:00
done