fleet/orbit/pkg/platform/platform_notwindows.go
Tomas Touceda a6acb1cd1a
Allow users to be readded if they were ever removed (#1945)
* Allow users to be readded if they were ever removed

* Address review comment

* lint
2021-09-07 13:33:40 -03:00

29 lines
785 B
Go

//go:build !windows
// +build !windows
package platform
import (
"os"
"github.com/fleetdm/fleet/v4/orbit/pkg/constant"
"github.com/pkg/errors"
)
// ChmodExecutableDirectory sets the appropriate permissions on an executable
// file. On POSIX this is a normal chmod call.
func ChmodExecutableDirectory(path string) error {
if err := os.Chmod(path, constant.DefaultDirMode); err != nil {
return errors.Wrap(err, "chmod executable directory")
}
return nil
}
// ChmodExecutable sets the appropriate permissions on the parent directory of
// an executable file. On POSIX this is a regular chmod call.
func ChmodExecutable(path string) error {
if err := os.Chmod(path, constant.DefaultExecutableMode); err != nil {
return errors.Wrap(err, "chmod executable")
}
return nil
}