in main/utils.go [224:248]
func setPermissions() error {
_, agentDir := getAgentPaths()
// get the list of files in the directory
files, err := ioutil.ReadDir(agentDir)
if err != nil {
lg.eventError("could not read files in agent directory", err)
return errors.Wrap(err, "could not read files in agent directory")
}
// set the permissions for each of the script files
for _, f := range files {
r, _ := regexp.Compile(".*\\.sh")
matches := r.FindStringSubmatch(f.Name())
if len(matches) > 0 {
name := filepath.Join(agentDir, f.Name())
err = os.Chmod(name, 0744)
if err != nil {
lg.eventError("could not set permissions for file: "+f.Name(), err)
return errors.Wrap(err, "could not set permissions for file: "+f.Name())
}
}
}
return nil
}