Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically no-overwrite in ssh-keygen

If I run

ssh-keygen -t rsa -N "" -f id_rsa

and the file id_rsa already exists, it will prompt me whether I want to overwrite:

id_rsa already exists.
Overwrite (y/n)?

How do I automatically answer no in a bash script? I checked man ssh-keygen but couldn't find any such option.

like image 414
Jase Avatar asked Oct 30 '25 02:10

Jase


1 Answers

you could simply do like this: echo "n"|ssh-keygen -t rsa -N "" -f id_rsa

like image 117
The_flash Avatar answered Nov 01 '25 18:11

The_flash