I'm trying to remove the password on a private key. Doing it by hand is simple, I run this command and enter the password :
openssl rsa <newkey.pem > newkey-no-password.pem
I'm trying to do this in an expect script, so that I don't have to actually type the password. Here is the code I wrote:
#!/usr/bin/expect -f set PASSWORD myPassword spawn openssl rsa <newkey.pem > newkey-no-pass.pem expect "Enter pass phrase:" send "$PASSWORD\r" expect eof
And here is the output I get when running the script:
[me@mymachine]# ./test.exp spawn openssl rsa <newkey.pem > newkey-no-pass.pem unknown option <newkey.pem rsa [options] <infile >outfile ... all the options for rsa command ...
I tried putting the
", to no avail.
What am I doing wrong and how can I fix this problem?