diff options
author | Michael Polenchuk <mpolenchuk@mirantis.com> | 2017-07-31 11:45:30 +0400 |
---|---|---|
committer | Michael Polenchuk <mpolenchuk@mirantis.com> | 2017-07-31 11:50:44 +0400 |
commit | bba5e84824a07416db140aa63b27ee6fc6e903cd (patch) | |
tree | 1df1e1ed05bf4eece8e8c2e48c7fedddac4f5b13 /mcp/scripts | |
parent | df50704b226a11f6ce9d0a46b178a5b8e8cd0284 (diff) |
Set key owner to original user in case of sudo
Change-Id: If964d36ad4f0cb6f1b2caf8544d4e35487f59c6c
Signed-off-by: Michael Polenchuk <mpolenchuk@mirantis.com>
Diffstat (limited to 'mcp/scripts')
-rw-r--r-- | mcp/scripts/lib.sh | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh index 3ec596a48..964f80fde 100644 --- a/mcp/scripts/lib.sh +++ b/mcp/scripts/lib.sh @@ -3,8 +3,10 @@ # generate_ssh_key() { + local user=${SUDO_USER:-$USER} + [ -f "$SSH_KEY" ] || ssh-keygen -f ${SSH_KEY} -N '' - install -o $USER -m 0600 ${SSH_KEY} /tmp/ + install -o $user -m 0600 ${SSH_KEY} /tmp/ } get_base_image() { |