Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lukapaunovic/6869d3e01be95ac2daa67587898a2db5 to your computer and use it in GitHub Desktop.
Save lukapaunovic/6869d3e01be95ac2daa67587898a2db5 to your computer and use it in GitHub Desktop.
fix-ownership-permissions.sh
#!/bin/bash
echo "Chmoding user files to 0644..."
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
echo "Done."
echo "Chmoding user folder to 0755..."
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
echo "Done."
echo "Fixing ownership of files..."
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
echo "Done."
echo "Fixing ownership of folders..."
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
echo "All Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment