From 73a84f90c59971a83ae005e1652602b7c216bdd6 Mon Sep 17 00:00:00 2001 From: Jody McIntyre Date: Fri, 7 Apr 2017 12:46:09 -0400 Subject: [PATCH] Set SSH_USER for root commands Previously, SSH_USER was not set for plugin:* or ssh-keys:add, which contradicts the user-auth trigger documentation. Fixes #2700 --- dokku | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dokku b/dokku index c663b240a..a8f4a3606 100755 --- a/dokku +++ b/dokku @@ -56,8 +56,12 @@ if [[ $(id -un) != "dokku" ]] && [[ ! $1 =~ plugin:* ]] && [[ ! $1 == "ssh-keys: exit $? fi -if [[ $(id -un) != "root" && $1 =~ ^plugin:.* && $1 != "plugin:help" && $1 != "plugin:list" ]] || [[ $(id -un) != "root" && $1 == "ssh-keys:add" ]]; then - dokku_log_fail "This command must be run as root" +if [[ $1 =~ ^plugin:.* && $1 != "plugin:help" && $1 != "plugin:list" ]] || [[ $1 == "ssh-keys:add" ]]; then + if [[ $(id -un) != "root" ]]; then + dokku_log_fail "This command must be run as root" + else + export SSH_USER=root + fi fi if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then