From 811fdce80f9f9322bc093cfa76baf0c30244e2b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=20Paunovi=C4=87?= Date: Sat, 12 May 2018 18:58:31 +0200 Subject: [PATCH] Create v-fix-websites-permissions The function fixes chmod and ownership permissions for all websites --- bin/v-fix-websites-permissions | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 bin/v-fix-websites-permissions diff --git a/bin/v-fix-websites-permissions b/bin/v-fix-websites-permissions new file mode 100644 index 000000000..c5497d4c1 --- /dev/null +++ b/bin/v-fix-websites-permissions @@ -0,0 +1,18 @@ +#!/bin/bash +# info: CHMOD & Ownership FIX +# options: NO OPTIONS +# +# The function fixes chmod and ownership permissions for all websites + +#!/bin/bash + +for i in `$VESTA/bin/v-list-sys-users | awk '{if(NR>2)print}'`; do +find /home/$i/web/ -name 'public_html' -type d -print0 | xargs -0 -I {} find '{}' -type f -print0 | xargs -0 -I {} chmod 0644 {}; +find /home/$i/web/ -name 'public_html' -type d -print0 | xargs -0 -I {} find '{}' -type f -print0 | xargs -0 -I {} chown $i:$i {}; + +find /home/$i/web/ -name 'public_html' -type d -print0 | xargs -0 -I {} find '{}' -type d -print0 | xargs -0 -I {} chmod 0755 {}; +find /home/$i/web/ -name 'public_html' -type d -print0 | xargs -0 -I {} find '{}' -type d -print0 | xargs -0 -I {} chown $i:$i {}; + +echo "All Done." + +done