From 5559300372dc77f363a2614db06ddcc72a86eec9 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Fri, 28 Oct 2016 16:52:38 -0700 Subject: [PATCH 1/2] Change folder permission event when not root --- client/allocdir/alloc_dir_unix.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/allocdir/alloc_dir_unix.go b/client/allocdir/alloc_dir_unix.go index 0c8185dfc..8c75b8ca8 100644 --- a/client/allocdir/alloc_dir_unix.go +++ b/client/allocdir/alloc_dir_unix.go @@ -43,7 +43,11 @@ func (d *AllocDir) linkOrCopy(src, dst string, perm os.FileMode) error { } func (d *AllocDir) dropDirPermissions(path string) error { - // Can't do anything if not root. + if err := os.Chmod(path, 0777); err != nil { + return fmt.Errorf("Chmod(%v) failed: %v", path, err) + } + + // Can't change owner if not root. if unix.Geteuid() != 0 { return nil } @@ -67,10 +71,6 @@ func (d *AllocDir) dropDirPermissions(path string) error { return fmt.Errorf("Couldn't change owner/group of %v to (uid: %v, gid: %v): %v", path, uid, gid, err) } - if err := os.Chmod(path, 0777); err != nil { - return fmt.Errorf("Chmod(%v) failed: %v", path, err) - } - return nil } From 9c58ed9c57c642a160b81e97cf074dc70d0c532e Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Fri, 28 Oct 2016 16:55:57 -0700 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e86c4cd91..05d6b27df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ BUG FIXES: [GH-1802] * cli: `alloc-status` does not query for allocation statistics if node is down [GH-1844] + * client: Folder permissions are dropped even when not running as root [GH-1888] * client: Prevent race when persisting state file [GH-1682] * client: Artifact download failures will be retried before failing tasks [GH-1558]