Advertisement
Kaineon

Untitled

Mar 13th, 2021
1,350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.61 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo -n "Create new group: "
  4. read GNAME
  5. while [ $(getent group $GNAME) ] do
  6.     echo "Group already exists. Enter new group name: "
  7.     read GNAME
  8. done
  9. sudo groupadd $GNAME
  10. echo "$GNAME created. Create a new user: "
  11. read UNAME
  12. while [ $(getent passwd $UNAME) ] do
  13.     echo "User already exists. Enter a new user name: "
  14.     read UNAME
  15. done
  16. sudo useradd -g $GNAME $UNAME
  17. echo "Welcome, $UNAME. Creating folder..."
  18. sudo mkdir /$UNAME
  19. echo "Done! Create a password: "
  20. sudo passwd $UNAME
  21. echo "Password set. User infomation is as follows: "
  22. id $UNAME
  23. sudo chown $UNAME:$GNAME /$UNAME
  24. sudo chmod 1775 /$UNAME
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement