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
This commit is contained in:
Eitan Adler 2014-03-01 03:36:46 +00:00
parent ef39d7e910
commit 0f4d097284

View File

@ -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
'\'
}