Advertisement
Wtalk2

Arch Linux Setup Script Part 3

May 25th, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.31 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Part 3 of Arch-Setup.sh Arch Linux Setup Script
  4.  
  5. # This script, created by James Triantafylos, will install and configure Arch Linux from start to finish.
  6.  
  7. # Instructions:
  8. # - RUN PART 1 AND 2 OF THIS SCRIPT FIRST
  9. # - Execute this script with ./Arch-Setup-Part3.sh
  10.  
  11. # Requirments:
  12. # - A wired network connection
  13. # - A disk over 24GB in size
  14. # - UEFI boot capability
  15.  
  16. # Goto function for BASH
  17. function goto
  18. {
  19.     label=$1
  20.     cmd=$(sed -n "/$label:/{:a;n;p;ba};" $0 | grep -v ':$')
  21.     eval "$cmd"
  22.     exit
  23. }
  24.  
  25. # Create a non-root user
  26. createUser: 2>&1 >/dev/null
  27. echo "Enter a username for the non-root user account: (Note: Must be all lowercase!)"
  28. read NONROOTUSER
  29. NONROOTUSER=${NONROOTUSER,,}
  30.  
  31. echo "Are you sure you would like to create the non-root user $NONROOTUSER? (Y = Yes, N = No)"
  32. read USERCREATECONFIRMATION
  33.  
  34. if [ $USERCREATECONFIRMATION == "Y" ] || [ $USERCREATECONFIRMATION == "y" ]; then
  35.     echo "Creating user $NONROOTUSER..."
  36. else
  37.     goto createUser
  38. fi
  39.  
  40. useradd -m $NONROOTUSER
  41. echo ""
  42.  
  43. # Set the non-root users password
  44. echo "Choose your non-root users password:"
  45. echo ""
  46. passwd $NONROOTUSER
  47. echo ""
  48.  
  49. # Give the non-root user Sudo capabilities
  50. echo "Giving the non-root user Sudo capabilities..."
  51. sed -i -e "\$a$NONROOTUSER ALL=(ALL) NOPASSWD:ALL" /etc/sudoers
  52. echo ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement