[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feeding passphase in a script?



On 10/28/25 5:46 PM, Rihad wrote:

Hi, I need to create a passphrased key in a shell script, and while testing it in a console it's still asking for the passphrase. Any way to do that easily?


$ echo -e "MyStrongPassword\nMyStrongPassword" | tarsnap-keymgmt --outkeyfile outkeyfile -w -r -d --nuke --passphrased keyfile   
Please enter passphrase for keyfile encryption:


Ok, after reading the source code I think I got it... tarsnap-keymgmt attempts to open /dev/tty no matter what and failing that reads from standard input. So running the pipeline above from cron or similar should work, since it has no tty open.