Closed amigthea closed 1 month ago
TEMP_DIR="$(mktemp -d)"
mkfifo $TEMP_DIR/auth
wush serve | while read l; do
echo "$l" >> $TEMP_DIR/auth
done &
AUTH="$(cat $TEMP_DIR/auth)"
echo "auth: $AUTH"
wait
and then you can use $AUTH variable for other commands
e.g.
wush ssh "--auth-key=$AUTH"
I wrote 2 scripts that help me with that. First one can automatically start wush serve
and notify about the auth key via ntfy: https://github.com/gdmn/scripts/blob/master/wush-serve.sh.
Then those keys are put in a file and can be used for ssh-ing into hosts: https://github.com/gdmn/scripts/blob/master/wush-ssh.sh.
Going to close, @gdmn's option seems to be the best here. We won't be able to accept the auth key via stdin because we'll need to attach that to the tty for input.
how can I directly pipe the auth id to wush commands without explicitly insert it by user input?