Skip to content

Commit

Permalink
Change default directory permissions to be more restrictive (#46) (#71)
Browse files Browse the repository at this point in the history
Make the config directory be 0755. Make the restic backups
directory be 0700.
  • Loading branch information
bawolff authored Feb 6, 2024
1 parent c626b3e commit 29c1a91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/restic/restic.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func checkCurrentSnapshotFolder(currentSnapshotFolder string) {
if _, err := os.Stat(currentSnapshotFolder); err != nil {
if os.IsNotExist(err) {
logging.Print("Creating..." + currentSnapshotFolder)
if err := os.Mkdir(currentSnapshotFolder, os.ModePerm); err != nil {
if err := os.Mkdir(currentSnapshotFolder, 0o700); err != nil {
logging.Fatal(err)
}
} else {
Expand All @@ -75,7 +75,7 @@ func checkCurrentSnapshotFolder(currentSnapshotFolder string) {
if err := os.RemoveAll(currentSnapshotFolder); err != nil {
logging.Fatal(err)
}
if err := os.Mkdir(currentSnapshotFolder, os.ModePerm); err != nil {
if err := os.Mkdir(currentSnapshotFolder, 0o700); err != nil {
logging.Fatal(err)
}
logging.Print("Emptied.. " + currentSnapshotFolder)
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func GetConfigDir() string {
fi, err := os.Stat(dir)
if os.IsNotExist(err) {
log.Print(fmt.Sprintf("Creating %s\n", dir))
err = os.MkdirAll(dir, os.ModePerm)
err = os.MkdirAll(dir, 0o755)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 29c1a91

Please sign in to comment.