Skip to content

Commit

Permalink
fix: 修改权限不使用sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Oct 24, 2024
1 parent 5dce305 commit 2225e59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/io/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ func Mkdir(path string, permission os.FileMode) error {

// Chmod 修改文件/目录权限
func Chmod(path string, permission os.FileMode) error {
cmd := exec.Command("sudo", "chmod", "-R", fmt.Sprintf("%o", permission), path)
cmd := exec.Command("chmod", "-R", fmt.Sprintf("%o", permission), path)
return cmd.Run()
}

// Chown 修改文件或目录所有者
func Chown(path, user, group string) error {
cmd := exec.Command("sudo", "chown", "-R", user+":"+group, path)
cmd := exec.Command("chown", "-R", user+":"+group, path)
return cmd.Run()
}

Expand Down

0 comments on commit 2225e59

Please sign in to comment.