Re: ssh-copy-id no newline bug

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



Ernesto Alfonso <erjoalgo@xxxxxxxxx> writes:

> When editing ~/.ssh/authorized_keys manually, sometimes users forget
> to add a newline at the end of the file, causing the next ssh-copy-id
> call to append a new key to an existing key, invalidating both keys.
>
> This can be fixed by simply adding a newline before appending the key.
>
> Something like this change to
> openssh-source/openssh-6.7p1/contrib/ssh-copy-id might work:

This seems like it should do no harm (given that sshd(8) declares that
blank lines are ignored as comments), although I'd instead do it by
adding a \n to the printf, thus:

  [ "$DRY_RUN" ] || printf '\n%s\n' "$NEW_IDS" | ssh ...

Is anyone going to be upset by the resulting blank lines being added by
ssh-copy-id when the file was not missing a terminating newline?

Cheers, Phil.
-- 
|)|  Philip Hands  [+44 (0)20 8530 9560]  HANDS.COM Ltd.
|-|  http://www.hands.com/    http://ftp.uk.debian.org/
|(|  Hugo-Klemm-Strasse 34,   21075 Hamburg,    GERMANY

Attachment: signature.asc
Description: PGP signature

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux