Created
August 12, 2023 13:38
-
-
Save SimonLammer/ac0da816617efd42f626c9157523f80c to your computer and use it in GitHub Desktop.
Read password from stdin into keyctl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# probably want to start a new session, so the key is removed once the script closes | |
keyctl new_session >/dev/null | |
# read tye key into keyctl | |
stty -echo | |
echo -n "Enter ssh password: " | |
password_key=$(read -s password && echo -n "$password" | keyctl padd user pw @s) | |
stty echo | |
echo "" | |
# pipe the key to some program | |
keyctl pipe "$password_key" | cat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment