ymy_ssh-keygen.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #! /bin/bash
  2. #title :ymy_ssh-keygen.sh
  3. #description :This script will create a yad dialog generating ssh-keys
  4. #author :frimo
  5. #date :2020-05-23
  6. #version :0.1
  7. #usage :ymy_ssh-keygen.sh
  8. #notes :This script should enable to generate ssh keys by gui
  9. # _
  10. # (///)(/
  11. # / /
  12. # create yad gui
  13. dialog=$(yad --width=640 --title="yad my ssh-keygen" \
  14. --center \
  15. --text="Configure your SSH Key:" \
  16. --image="info" \
  17. --form \
  18. --field="Filename" \
  19. --field="Passphrase":H \
  20. --field="Algorithm":CB \
  21. "" "" 'rsa!dsa!ecdsa!ed25519')
  22. # get status of yad dialog
  23. status=$?
  24. # quit application if status is 0
  25. [[ $status -eq 1 ]] && exit 0
  26. # get values from yad dialog
  27. filename=$(echo $dialog | awk 'BEGIN {FS="|" } { print $1 }')
  28. passphrase=$(echo $dialog | awk 'BEGIN {FS="|" } { print $2 }')
  29. algorithm=$(echo $dialog | awk 'BEGIN {FS="|" } { print $3 }')
  30. # print created bash command
  31. echo "ssh-keygen -f ~/.ssh/$filename -t $algorithm -q -N $passphrase"
  32. # execute created bash command
  33. ssh-keygen -f ~/.ssh/$filename -t $algorithm -q -N $passphrase
  34. # exit application
  35. exit 0