ssh_import_id doesn't like carriage return (^M)
Bug #651698 reported by
Mathias Gug
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ssh-import-id (Ubuntu) |
Fix Released
|
Low
|
Dustin Kirkland |
Bug Description
Binary package hint: cloud-init
Running ami-60699c09 with the following user-data:
#cloud-config
ssh_import_id: [mathiaz, james-page]
Only the first login (mathiaz) is added to the ubuntu authorized_keys. The second login (james-page) is not added to the authorized_key file.
Changed in openssh (Ubuntu): | |
status: | Confirmed → Triaged |
summary: |
- Second login to ssh_import_id in cloud-config doesn't get added to - authorized_keys file + ssh_import_id doesn't like carriage return (^M) |
Changed in openssh (Ubuntu): | |
assignee: | nobody → Dustin Kirkland (kirkland) |
To post a comment you must log in.
mathiaz's error was due to james-page keys not being considered valid by ssh-import-id.
The final hex characters in his currently uploaded keys are:
0d0a 0d0a
I think the proper fix to ssh-import-id is:
--- ssh-import-id 2010-07-22 10:02:11.000000000 -0400
+++ ssh-import-id 2010-09-29 23:18:36.956997685 -0400
@@ -68,8 +68,8 @@
validate_keys() {
# Prune blank lines, join lines that don't have a '= ',
# remove invalid characters
- sed -i -e '/^$/d' \
- -e ':join /=[ ]/!{ N; s/\n// ; b join }' \
+ sed -i -e '/^$/d' -e '/^\r/d' \
+ -e ':join /=[ ]/!{ N; s/[\n\r]// ; b join }' \
-e 's/[^a-zA-Z0-9@: .\/=+-]//g' "$1"
# Count lines
lines=$(wc -l < "${1}")