diff -up openssh-5.5p1/ssh-keygen.0.keygen openssh-5.5p1/ssh-keygen.0 --- openssh-5.5p1/ssh-keygen.0.keygen 2010-04-16 02:17:11.000000000 +0200 +++ openssh-5.5p1/ssh-keygen.0 2010-05-04 08:19:22.000000000 +0200 @@ -4,7 +4,7 @@ NAME ssh-keygen - authentication key generation, management and conversion SYNOPSIS - ssh-keygen [-q] [-b bits] -t type [-N new_passphrase] [-C comment] + ssh-keygen [-q] [-o] [-b bits] -t type [-N new_passphrase] [-C comment] [-f output_keyfile] ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile] ssh-keygen -i [-f input_keyfile] @@ -222,6 +222,8 @@ DESCRIPTION -q Silence ssh-keygen. Used by /etc/rc when creating a new key. + -o Overwrite the key without prompting user. + -R hostname Removes all keys belonging to hostname from a known_hosts file. This option is useful to delete hashed hosts (see the -H option diff -up openssh-5.5p1/ssh-keygen.1.keygen openssh-5.5p1/ssh-keygen.1 --- openssh-5.5p1/ssh-keygen.1.keygen 2010-03-21 19:57:49.000000000 +0100 +++ openssh-5.5p1/ssh-keygen.1 2010-05-04 08:19:22.000000000 +0200 @@ -47,6 +47,7 @@ .Nm ssh-keygen .Bk -words .Op Fl q +.Op Fl o .Op Fl b Ar bits .Fl t Ar type .Op Fl N Ar new_passphrase @@ -370,6 +371,8 @@ Silence Used by .Pa /etc/rc when creating a new key. +.It Fl o +Overwrite the key without prompting user. .It Fl R Ar hostname Removes all keys belonging to .Ar hostname diff -up openssh-5.5p1/ssh-keygen.c.keygen openssh-5.5p1/ssh-keygen.c --- openssh-5.5p1/ssh-keygen.c.keygen 2010-03-21 19:58:24.000000000 +0100 +++ openssh-5.5p1/ssh-keygen.c 2010-05-04 08:22:22.000000000 +0200 @@ -72,6 +72,7 @@ int change_passphrase = 0; int change_comment = 0; int quiet = 0; +int overwrite = 0; int log_level = SYSLOG_LEVEL_INFO; @@ -1540,7 +1541,7 @@ main(int argc, char **argv) exit(1); } - while ((opt = getopt(argc, argv, "degiqpclBHLhvxXyF:b:f:t:D:I:P:N:n:" + while ((opt = getopt(argc, argv, "degiqopclBHLhvxXyF:b:f:t:D:I:P:N:n:" "O:C:r:g:R:T:G:M:S:s:a:V:W:")) != -1) { switch (opt) { case 'b': @@ -1605,6 +1606,9 @@ main(int argc, char **argv) case 'q': quiet = 1; break; + case 'o': + overwrite = 1; + break; case 'e': case 'x': /* export key */ @@ -1835,7 +1839,7 @@ main(int argc, char **argv) printf("Created directory '%s'.\n", dotsshdir); } /* If the file already exists, ask the user to confirm. */ - if (stat(identity_file, &st) >= 0) { + if (!overwrite && stat(identity_file, &st) >= 0) { char yesno[3]; printf("%s already exists.\n", identity_file); printf("Overwrite (y/n)? ");