diff options
author | Leif Johansson <leifj@sunet.se> | 2013-09-02 16:01:50 +0200 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2013-09-02 16:01:50 +0200 |
commit | 7515782eb503152dfc3e84fee1260fb10d560df9 (patch) | |
tree | ce0087dc774a156c6a74f11d3af92ef5686b4972 /global/post-tasks.d/010fix-ssh-perms |
import
Diffstat (limited to 'global/post-tasks.d/010fix-ssh-perms')
-rwxr-xr-x | global/post-tasks.d/010fix-ssh-perms | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/global/post-tasks.d/010fix-ssh-perms b/global/post-tasks.d/010fix-ssh-perms new file mode 100755 index 0000000..87636d7 --- /dev/null +++ b/global/post-tasks.d/010fix-ssh-perms @@ -0,0 +1,23 @@ +#!/bin/sh +# +# Re-used example from SJD +# + +if test -d /root/.ssh && \ + test `stat -t /root/.ssh | cut -d\ -f5` != 0; then + chown root.root /root/.ssh +fi + +if test -d /root/.ssh && \ + test `stat -c %a /root/.ssh` != 700; then + chmod 700 /root/.ssh +fi + +if test -f /root/.ssh/authorized_keys; then + if test `stat -t /root/.ssh/authorized_keys | cut -d\ -f5` != 0; then + chown root.root /root/.ssh/authorized_keys + fi + if test `stat --printf=%a /root/.ssh/authorized_keys` != 600; then + chmod 600 /root/.ssh/authorized_keys + fi +fi |