Got a bunch of public directories you need to set permissions on?  Here ya go…

#!/bin/bash<br></br> #set the owner and group for these directories recursively<br></br> chown -R bill:noobs /pub/this<br></br> chown -R bill:noobs /pub/that<br></br> chown -R bill:noobs /pub/theotherthing<br></br> #set perms for all sub-directories<br></br> find /pub/this -type d | xargs -d"\n" chmod 755<br></br> find /pub/that -type d | xargs -d"\n" chmod 755<br></br> find /pub/theotherthing -type d | xargs -d"\n" chmod 755<br></br> #set perms for all files<br></br> find /pub/this -type f | xargs -d"\n" chmod 644<br></br> find /pub/that -type f | xargs -d"\n" chmod 644<br></br> find /pub/theotherthing -type f | xargs -d"\n" chmod 644

755 = recurse dirs and read whats in them for group and other, owner can do whatever
644 = owner can read and write but not execute and all the rest can read.

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.