Skip to content

Instantly share code, notes, and snippets.

@devilholk
Created October 12, 2020 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devilholk/b35aa117d957ca0922bae521b8b1d114 to your computer and use it in GitHub Desktop.
Save devilholk/b35aa117d957ca0922bae521b8b1d114 to your computer and use it in GitHub Desktop.
Fix a problem with ssh-copy-id
--- /usr/bin/ssh-copy-id 2020-10-02 18:28:13.000000000 +0200
+++ ./test.sh 2020-10-12 05:34:42.469599079 +0200
@@ -247,7 +247,7 @@
# the -z `tail ...` checks for a trailing newline. The echo adds one if was missing
# the cat adds the keys we're getting via STDIN
# and if available restorecon is used to restore the SELinux context
- INSTALLKEYS_SH=$(tr '\t\n' ' ' <<-EOF)
+ INSTALLKEYS_SH=$(tr '\t\n' ' ' <<-EOF
cd;
umask 077;
mkdir -p $(dirname "${AUTH_KEY_FILE}") &&
@@ -258,7 +258,7 @@
restorecon -F .ssh ${AUTH_KEY_FILE};
fi
EOF
-
+)
# to defend against quirky remote shells: use 'exec sh -c' to get POSIX;
printf "exec sh -c '%s'" "${INSTALLKEYS_SH}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment