aboutsummaryrefslogtreecommitdiffstats
path: root/mcp
diff options
context:
space:
mode:
Diffstat (limited to 'mcp')
-rw-r--r--mcp/scripts/lib.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
index 8d4510084..d9c6454f2 100644
--- a/mcp/scripts/lib.sh
+++ b/mcp/scripts/lib.sh
@@ -4,7 +4,10 @@
#
generate_ssh_key() {
- local user=${SUDO_USER:-$USER}
+ local user=${USER}
+ if [ -n "${SUDO_USER}" ] && [ "${SUDO_USER}" != 'root' ]; then
+ user=${SUDO_USER}
+ fi
[ -f "${SSH_KEY}" ] || ssh-keygen -f "${SSH_KEY}" -N ''
install -o "${user}" -m 0600 "${SSH_KEY}" /tmp/