Problem with ssh-copy-id when home folder contains spaces

Corinna Vinschen vinschen at redhat.com
Sun Mar 13 06:42:47 AEDT 2016


Hi,

some guy on the Cygwin mailing list found that ssh-copy-id chokes
on directories with spaces, which are quite common on Windows.

He also provided an easy fix, basically just adding quotes, which I
attached to this mail.  Would that be ok to apply upstream?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
diff --git a/usr/bin/ssh-copy-id.old b/usr/bin/ssh-copy-id
index afde8b1..bef5c95 100755
--- a/usr/bin/ssh-copy-id.old
+++ b/usr/bin/ssh-copy-id
@@ -233,17 +233,17 @@ populate_new_ids() {
             -o ControlPath=none \
             -o LogLevel=INFO \
             -o PreferredAuthentications=publickey \
-            -o IdentitiesOnly=yes "$@" exit 2>$L_TMP_ID_FILE.stderr </dev/null
+            -o IdentitiesOnly=yes "$@" exit 2>"$L_TMP_ID_FILE.stderr" </dev/null
         if [ "$?" = "$L_SUCCESS" ] ; then
-          : > $L_TMP_ID_FILE
+          : > "$L_TMP_ID_FILE"
         else
-          grep 'Permission denied' $L_TMP_ID_FILE.stderr >/dev/null || {
-            sed -e 's/^/ERROR: /' <$L_TMP_ID_FILE.stderr >$L_TMP_ID_FILE
+          grep 'Permission denied' "$L_TMP_ID_FILE.stderr" >/dev/null || {
+            sed -e 's/^/ERROR: /' <"$L_TMP_ID_FILE.stderr" >"$L_TMP_ID_FILE"
             cat >/dev/null #consume the other keys, causing loop to end
           }
         fi
 
-        cat $L_TMP_ID_FILE
+        cat "$L_TMP_ID_FILE"
       done
     }
   )
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20160312/d866d28c/attachment-0001.bin>


More information about the openssh-unix-dev mailing list