My problem is , the second commmand expecting a user input
Eg :
Press Enter for below three questions and issue your password
Enter file in which to save the key (/home/v45542/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Every time I have to press enter for these three question whenever I run the script. I want to skip or it should automatically skip this three questions. Please help in this . I am new to this thread
Here is the simple code I wrote in 3 minutes to generate key automatically:
#!/usr/bin/expect
spawn /usr/bin/ssh-keygen
expect "Enter file in which to save the key" {send "\n"}
expect "Enter passphrase" {send "\n"}
expect "Enter same passphrase again" {send "\n"}
Then the output here (I type nothing)
>> ./genkey.sh
spawn /usr/bin/ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/xxx/xxxxxxx/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
>>