aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2014-06-25 16:25:05 +0100
committerAlex Bennée <alex.bennee@linaro.org>2014-07-10 09:17:24 +0100
commit49cf199525730c9a293ca4b6676dd058a23209a7 (patch)
tree802665222ff7050ea8919a22c527ee9d70f1ad7c
parent6818e4c00058bead8ddff94303373aab37c18fbf (diff)
downloadhacking-sessions-49cf199525730c9a293ca4b6676dd058a23209a7.tar.gz
setup_session_debian: ensure .ssh permissions are correct
There are two potential failure modes being guarded against. - buggy NFS mounts which squash 0600 perms - running setup under sudo -s for a "real" user Change-Id: Icd6725424b75c6a365cf7d0f7b69f7deeca6179a Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
-rwxr-xr-xsetup_session_debian8
1 files changed, 8 insertions, 0 deletions
diff --git a/setup_session_debian b/setup_session_debian
index 4352d2d..2404015 100755
--- a/setup_session_debian
+++ b/setup_session_debian
@@ -8,7 +8,15 @@ cp invoke_session_debian /bin/invoke_session
mkdir -p ~/.ssh/
echo $1 >> ~/.ssh/authorized_keys
+chmod 0600 ~/.ssh/authorized_keys
echo "Public Key Installed: $1"
+# Account for running under sudo
+if [ ! -z "${SUDO_USER}" ]; then
+ echo "Fixing up ${HOME}/.ssh permissions to ${SUDO_USER}:${SUDO_GID}"
+ chown -R ${SUDO_USER}:${SUDO_GID} ${HOME}/.ssh
+fi
+
+
/etc/init.d/ssh restart
echo "sshd re-started"