[Linux-disciples] SSH: Testing whether ID is already in authorized_keys

Stephen R Laniel steve at laniels.org
Sun Sep 4 13:00:56 EDT 2005


On Sun, Sep 04, 2005 at 12:53:51PM -0400, Adam Rosi-Kessel wrote:
> You could copy it over, grep the authorized_keys for the file, and only
> add it if it's not in there. I think any solution to this problem is
> going to be some sort of hack.

Yeah, I thought of that approach. The trouble with this
alternative approach is that it's basically replacing
ssh-copy-id: copy the key over, then add it to
authorized_keys. Though the trouble with my approach -- do
the ssh-copy-id, then get rid of duplicates in
authorized_keys -- is that it requires two SSH connections
in sequence (one to do the ssh-copy-id, one to connect and
get rid of dups).

Though I suppose the boundary between a hack and a clean
solution is pretty thin: ssh-copy-id itself is just a shell
script -- albeit a more-thoroughly-debugged shell script
than most.

-- 
Stephen R. Laniel
steve at laniels.org
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20050904/2a2d182a/attachment.pgp


More information about the Linux-disciples mailing list