Update permissions for peach home dir in peach-config

This commit is contained in:
notplants 2022-04-14 16:29:57 -04:00
parent 1866e289a6
commit 315b04a63e
3 changed files with 5 additions and 3 deletions

2
Cargo.lock generated
View File

@ -2380,7 +2380,7 @@ dependencies = [
[[package]]
name = "peach-config"
version = "0.1.19"
version = "0.1.20"
dependencies = [
"clap",
"env_logger 0.6.2",

View File

@ -1,6 +1,6 @@
[package]
name = "peach-config"
version = "0.1.19"
version = "0.1.20"
authors = ["Andrew Reid <gnomad@cryptolab.net>", "Max Fowler <max@mfowler.info>"]
edition = "2018"
description = "Command line tool for installing, updating and configuring PeachCloud"

View File

@ -5,6 +5,7 @@ use crate::utils::cmd;
/// so they can be read and written by all PeachCloud services.
pub const CONFIGS_DIR: &str = "/var/lib/peachcloud";
pub const PEACH_WEB_DIR: &str = "/usr/share/peach-web";
pub const PEACH_HOME_DIR: &str = "/home/peach";
/// Utility function to set correct file permissions on the PeachCloud device.
/// Accidentally changing file permissions is a fairly common thing to happen,
@ -15,7 +16,8 @@ pub fn set_permissions() -> Result<(), PeachConfigError> {
cmd(&["chown", "-R", "peach", CONFIGS_DIR])?;
cmd(&["chgrp", "-R", "peach", CONFIGS_DIR])?;
cmd(&["chmod", "-R", "u+rwX,g+rwX", PEACH_WEB_DIR])?;
cmd(&["chown", "-R", "peach-web:peach", PEACH_WEB_DIR])?;
cmd(&["chown", "-R", "peach:peach", PEACH_WEB_DIR])?;
cmd(&["chown", "-R", "peach:peach", PEACH_HOME_DIR])?;
println!("[ PERMISSIONS SUCCESSFULLY UPDATED ]");
Ok(())
}