aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/ssh-askpass
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2024-11-08 20:43:20 +0000
committerJustine Smithies <justine@smithies.me.uk>2024-11-08 20:43:20 +0000
commit8d0bdf6bef075ea538f05759528e58bad166b924 (patch)
treefe823b1ef3ca8f041d37c480b0c99ae4393a48f8 /.local/bin/ssh-askpass
parent47f3bc8e0a8784f849cce23c9dfa72d1ea1d22b0 (diff)
Initial commit
Diffstat (limited to '.local/bin/ssh-askpass')
-rwxr-xr-x.local/bin/ssh-askpass14
1 files changed, 14 insertions, 0 deletions
diff --git a/.local/bin/ssh-askpass b/.local/bin/ssh-askpass
new file mode 100755
index 0000000..d3bbc91
--- /dev/null
+++ b/.local/bin/ssh-askpass
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+# Remember to export SSH_ASKPASS=~/.local/bin/ssh-askpass in your .bashrc
+RESULT=$(pinentry-curses --ttytype=xterm-color --lc-ctype=en_US.UTF8 --ttyname=/dev/tty <<END | grep -E '^(D|ERR)'
+SETDESC Enter your SSH password:
+SETPROMPT
+GETPIN
+END
+)
+
+if [ "$RESULT" == "ERR 111 canceled" ]; then
+ exit 255
+else
+ echo ${RESULT:2:${#RESULT}-2}
+fi