mirror of
https://gitea.blesmrt.net/mikaela/scripts.git
synced 2025-02-02 07:44:04 +01:00
addusers: initial commit (#7)
This commit is contained in:
parent
73d09c16cb
commit
e9a8bab339
27
bash/addusers
Normal file
27
bash/addusers
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#!/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
|
||||||
|
for user in matti tommi tiina nenne lena
|
||||||
|
do
|
||||||
|
# To see that it works
|
||||||
|
echo "Current user: $user"
|
||||||
|
# Create the user & homedir if it doesn't exist
|
||||||
|
useradd -m $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"
|
||||||
|
done
|
||||||
|
|
||||||
|
# And next sudoers
|
||||||
|
for sudoer in matti tommi tiina
|
||||||
|
do
|
||||||
|
# Add the user to sudo group (as they are administrator)
|
||||||
|
echo "Current sudoer: $sudoer"
|
||||||
|
usermod -a -G sudo $sudoer
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user