mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-25 00:50:31 +00:00
fix using rsync if running sftpgo as non-root user (#1535)
Signed-off-by: Jerome Küttner <j.kuettner@mittwald.de>
This commit is contained in:
parent
e315e48c39
commit
2bbd8b3a5f
1 changed files with 3 additions and 1 deletions
|
@ -18,12 +18,14 @@
|
|||
package sftpd
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func wrapCmd(cmd *exec.Cmd, uid, gid int) *exec.Cmd {
|
||||
if uid > 0 || gid > 0 {
|
||||
isCurrentUser := os.Getuid() == uid && os.Getgid() == gid
|
||||
if (uid > 0 || gid > 0) && !isCurrentUser {
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{}
|
||||
cmd.SysProcAttr.Credential = &syscall.Credential{Uid: uint32(uid), Gid: uint32(gid)}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue