From 0f4d09728465f496a4d8d6de1875dc6c2dad11b3 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 1 Mar 2014 03:36:46 +0000 Subject: [PATCH] ssh-copy-id: add restorecon call In certain situations when creating an authorized_key file on a Linux machine restorecon(1) may need to be called. Therefore, attempt to run it if it exists. MFC After: 1 week Idea from: https://bugzilla.redhat.com/show_bug.cgi?id=739989 --- usr.bin/ssh-copy-id/ssh-copy-id.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.bin/ssh-copy-id/ssh-copy-id.sh b/usr.bin/ssh-copy-id/ssh-copy-id.sh index 789fbe62b882..e16cfaa8456a 100755 --- a/usr.bin/ssh-copy-id/ssh-copy-id.sh +++ b/usr.bin/ssh-copy-id/ssh-copy-id.sh @@ -46,6 +46,9 @@ sendkey() { printf "$alg $key $comment\n" >> "$keyfile" ; \ fi ; \ done \ + if [ -x /sbin/restorecon ]; then \ + /sbin/restorecon -F "$HOME/.ssh/" "$keyfile" >/dev/null 2>&1 || true ; \ + fi '\' }