Advertisement
Guest User

bash aliases

a guest
Mar 2nd, 2017
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. # Generate random passwords of arbitrary length
  2. # - with no arguments genpasswd will produce a 20 character random password
  3. # - genpasswd alos accepts an integer value to produce random passwords of
  4. # arbitrary length (within the limits of the random source)
  5. create_passwd ()
  6. {
  7. local i=$1
  8. [ "$i" == "" ] && i=20
  9. # uses /dev/random as the random source - slower 'more random'
  10. # tr -dc A-Za-z0-9_ < /dev/random | head -c ${i} | xargs
  11. # uses /dev/urandom as the random source- faster 'less random'
  12. tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${i} | xargs
  13. }
  14.  
  15. # Generate ssh key pairs
  16. # - requires ssh-keygen
  17. # - generates strong key pairs
  18. # - key pairs are uniquely identifiable
  19. create_ssh ()
  20. {
  21. ssh-keygen -b 4096 -v -C "$(whoami)@$(hostname) $(date +"%F-%T (%A %B %d %Y %H:%M %Z %z)")"
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement