From 264eacc3f9dc52642cc15ca98708867f1cf1808b Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Sat, 14 Dec 2019 22:55:45 +0100 Subject: [PATCH] Added some empty dirs and files that may be used within a chroot --- var/www/cron.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/var/www/cron.php b/var/www/cron.php index 4de6ea4..41056a8 100644 --- a/var/www/cron.php +++ b/var/www/cron.php @@ -24,7 +24,7 @@ while($id=$stmt->fetch(PDO::FETCH_NUM)){ exec('useradd -l -p ' . escapeshellarg($id[2]) . ' -g www-data -k /var/www/skel -m -s ' . escapeshellarg($shell) . ' ' . escapeshellarg($system_account)); exec('/var/www/setup_chroot.sh ' . escapeshellarg("/home/$system_account")); exec('grep ' . escapeshellarg($system_account) . ' /etc/passwd >> ' . escapeshellarg("/home/$system_account/etc/passwd")); - foreach(['.ssh', 'data', 'Maildir'] as $dir){ + foreach(['.cache', '.composer', '.config', '.local', '.ssh', 'data', 'Maildir'] as $dir){ mkdir("/home/$system_account/$dir", 0700); chown("/home/$system_account/$dir", $system_account); chgrp("/home/$system_account/$dir", 'www-data'); @@ -34,6 +34,12 @@ while($id=$stmt->fetch(PDO::FETCH_NUM)){ chown("/home/$system_account/$dir", $system_account); chgrp("/home/$system_account/$dir", 'www-data'); } + foreach(['.bash_history', '.bashrc', '.gitconfig', '.profile'] as $file){ + touch("/home/$system_account/$file"); + chmod("/home/$system_account/$file", 0600); + chown("/home/$system_account/$file", $system_account); + chgrp("/home/$system_account/$file", 'www-data'); + } //remove from to-add queue $del->execute([$id[5]]); }