diff options
author | eadler <eadler@FreeBSD.org> | 2014-03-01 03:36:46 +0000 |
---|---|---|
committer | eadler <eadler@FreeBSD.org> | 2014-03-01 03:36:46 +0000 |
commit | 24b6155d21d9dc1d0726c3d2c57621e4dcd594c5 (patch) | |
tree | 40713abac192d8d31397a549c052d53295ea7de6 | |
parent | 4e6374765e21c44d489f2462699675f7d5f3667f (diff) | |
download | FreeBSD-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
-rwxr-xr-x | usr.bin/ssh-copy-id/ssh-copy-id.sh | 3 |
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 '\' } |