Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # read username
  4. read -p "Username: " username
  5.  
  6. # read password twice
  7. read -s -p "Password: " password
  8. echo
  9. read -s -p "Password (again): " password2
  10.  
  11. # check if passwords match and if not ask again
  12. while [ "$password" != "$password2" ];
  13. do
  14. echo
  15. echo "Please try again"
  16. read -s -p "Password: " password
  17. echo
  18. read -s -p "Password (again): " password2
  19. done
  20.  
  21.  
  22. printf "$username:$(openssl passwd -crypt $password)\n" >> .htpasswd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement