aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/ssh-askpass.sh
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2024-12-17 22:12:37 +0000
committerJustine Smithies <justine@smithies.me.uk>2024-12-17 22:12:37 +0000
commit9356ccbc0196babcfc2d076ad85a994d79cc0046 (patch)
tree2dd155d5b6562add29c99ae95d4769e73b71496a /.local/bin/ssh-askpass.sh
parente98cad6ec1922af77b96307069ffcd41009f7478 (diff)
Changed ssh-askpass to a posix sh script.
Diffstat (limited to '.local/bin/ssh-askpass.sh')
-rwxr-xr-x.local/bin/ssh-askpass.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/.local/bin/ssh-askpass.sh b/.local/bin/ssh-askpass.sh
new file mode 100755
index 0000000..879a882
--- /dev/null
+++ b/.local/bin/ssh-askpass.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+# Remember to export SSH_ASKPASS=~/.local/bin/ssh-askpass.sh
+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
+ length=$(printf "%s" "$RESULT" | wc -c)
+ length=$((length))
+ echo "$RESULT" : '..' | cut -c 3-"$length"
+fi