[HOWTO] Correct files and folders permissions and ownership

Section with modification and patches for Vesta
lukapaunovic
Posts: 4
Joined: Sun Dec 03, 2017 6:30 pm

[HOWTO] Correct files and folders permissions and ownership

Postby lukapaunovic » Sun Dec 03, 2017 6:39 pm

To fix files & folders permissions and ownership just run following commands in the shell.
I had a lot of WordPress sites struggling with update/upload so I wrote this.
# Chmod files 0644

Code: Select all

for i in `/usr/local/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 {}; done

# Chown files

Code: Select all

for i in `/usr/local/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 {} chown $i:$i {}; done

# Chmod folders 0755

Code: Select all

for i in `/usr/local/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 d -print0 | xargs -0 -I {} chmod 0755 {}; done

# Chown folders

Code: Select all

for i in `/usr/local/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 d -print0 | xargs -0 -I {} chown $i:$i {}; done

Return to “Modification & Patches”



Who is online

Users browsing this forum: No registered users and 1 guest