-
if [ $(id -u) -eq 0 ]; then
-
for user in $NEW_USERS; do echo $user if id "$user" &>/dev/null then echo "user exists"else
-
useradd -m -d /home/$user
-s /bin/bash
-g developers $user echo "New User Created" -
echo
su - -c "mkdir ~/.ssh" $user echo ".ssh and home folder successfully created for new user "
-
echo
su - -c "chmod 700 ~/.ssh" $user echo "directory Permission set for created user"
-
echo
su - -c "touch ~/.ssh/authorized_keys" $user echo "authorized_keys directly successfully created"
-
echo
su - -c "chmod 600 ~/.ssh/authorized_keys" $user echo "Permission set successfully for authorized_keys file"
-
cp -R "/root/onboard/id_rsa.pub" "/home/$user/.ssh/authorized_keys"
echo "public key file successfully copied to user account on the server"
echo "User Successfully Created"
-
sudo echo -e "teejay\nteejay" | sudo passwd "$user"
sudo passwd -x 7 $user
fi
done
else
echo "only Admin can onboard a User"
fi
-
Notifications
You must be signed in to change notification settings - Fork 0
Shell Scripting
License
teejay4u/Aux_Project
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Shell Scripting
Topics
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published