Read-only on /dev/tty causes ssh-add to show passwords when typed and ssh'ing to new hosts to fail

Ángel González keisial at gmail.com
Wed Jul 30 05:51:17 EST 2014


On 21/07/14 09:10, Gert Doering wrote:
> Well, you already *have* that special case - "if /dev/tty isn't working,
> assume we do not have a controlling tty and use stdin".  The question is
> whether you can (and want to) distinguish "I have no controlling tty"
> from "/dev/tty is messed up ->  print error and die".
>
> gert

Well, if you consider ssh-add should fail in that case, you can simply 
do this:
> diff --git a/ssh-add.c b/ssh-add.c
> index 3421452..977b3f1 100644
> --- a/ssh-add.c
> +++ b/ssh-add.c
> @@ -213,7 +213,7 @@ add_file(AuthenticationConnection *ac, const char 
> *filename, int key_only)
>                 snprintf(msg, sizeof msg, "Enter passphrase for %.200s: ",
>                     comment);
>                 for (;;) {
> -                       pass = read_passphrase(msg, RP_ALLOW_STDIN);
> +                       pass = read_passphrase(msg, 0);
>                         if (strcmp(pass, "") == 0) {
>                                 clear_pass();
>                                 free(comment);




More information about the openssh-unix-dev mailing list