From 3ba4145d267d85b6c2daaa3c254b5dd44a73d6fb Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Mon, 8 Nov 2021 10:53:43 +0800
Subject: [PATCH 07/12] non-root user deploy bug fixed

Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
 pkg/utils/runner/runner.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pkg/utils/runner/runner.go b/pkg/utils/runner/runner.go
index 9e1689e..c7088df 100644
--- a/pkg/utils/runner/runner.go
+++ b/pkg/utils/runner/runner.go
@@ -179,7 +179,8 @@ func prepareUserTempDir(conn ssh.Connection, host *kkv1alpha1.HostCfg) error {
 	var sb strings.Builder
 	sb.WriteString("sudo -E /bin/sh -c \"")
 	sb.WriteString(fmt.Sprintf("mkdir -p %s", dir))
-	sb.WriteString(fmt.Sprintf(" && chown -R %s:%s %s", host.User, host.User, dir))
+	// chown .eggo dir
+	sb.WriteString(fmt.Sprintf(" && chown -R %s:%s %s", host.User, host.User, filepath.Dir(dir)))
 	sb.WriteString("\"")
 	_, err := conn.Exec(sb.String(), host)
 	if err != nil {
-- 
2.25.1

