Select Page

I often work on my websites as my root user on my Ubuntu VPS running Vesta. When I copy over WordPress or other files they’ll retain root ownership. Rather than having to chown every file and folder I’ve worked on, I run this simple script to set proper ownership. I named it own.sh and put it in /root/.

echo
echo
echo Setting ownership on users\’ web folders …
echo
for dir in /home/*; do
dir=$(echo $dir | cut -c 7-)
echo “$dir”
chown -R “$dir”:”$dir” /home/”$dir”/web/
done
echo
echo Done!
echo