Skip to content

Commit

Permalink
move chown to LimitPrivileges function
Browse files Browse the repository at this point in the history
  • Loading branch information
caffeinated92 committed Nov 14, 2024
1 parent 8cbaba0 commit 0342c1d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,9 @@ func (repman *ReplicationManager) LimitPrivileges() {

repman.LogModulePrintf(repman.Conf.Verbose, config.ConstLogModGeneral, config.LvlInfo, "Setting uid and gid to target user: %s, uid: %d, gid: %d", targetUser.Username, uidInt, gidInt)

// Compatibility with old version, for files with root level permission in workingdir
misc.ChownR(repman.Conf.WorkingDir, uidInt, gidInt)

// Set GID (Group ID)
err = syscall.Setgid(gidInt)
if err != nil {
Expand Down Expand Up @@ -1686,11 +1689,6 @@ func (repman *ReplicationManager) Run() error {
u, err := user.Lookup(repman.Conf.MonitoringSystemUser)
if err == nil {
ExpectedUser = u

// Compatibility with old version, for files with root level permission in workingdir
uid, _ := strconv.Atoi(ExpectedUser.Uid)
gid, _ := strconv.Atoi(ExpectedUser.Gid)
misc.ChownR(repman.Conf.WorkingDir, uid, gid)
}
}

Expand Down

0 comments on commit 0342c1d

Please sign in to comment.