summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authoreadler <eadler@FreeBSD.org>2014-03-01 03:36:46 +0000
committereadler <eadler@FreeBSD.org>2014-03-01 03:36:46 +0000
commit24b6155d21d9dc1d0726c3d2c57621e4dcd594c5 (patch)
tree40713abac192d8d31397a549c052d53295ea7de6 /usr.bin
parent4e6374765e21c44d489f2462699675f7d5f3667f (diff)
downloadFreeBSD-src-24b6155d21d9dc1d0726c3d2c57621e4dcd594c5.zip
FreeBSD-src-24b6155d21d9dc1d0726c3d2c57621e4dcd594c5.tar.gz
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
Diffstat (limited to 'usr.bin')
-rwxr-xr-xusr.bin/ssh-copy-id/ssh-copy-id.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/usr.bin/ssh-copy-id/ssh-copy-id.sh b/usr.bin/ssh-copy-id/ssh-copy-id.sh
index 789fbe6..e16cfaa 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
'\'
}
OpenPOWER on IntegriCloud