Created
October 12, 2020 03:39
-
-
Save devilholk/b35aa117d957ca0922bae521b8b1d114 to your computer and use it in GitHub Desktop.
Fix a problem with ssh-copy-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /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