Bash Script To Repair Directory and File Ownership

Posted by ServerChecker on Server Fault See other posts from Server Fault or by ServerChecker
Published on 2010-05-11T06:58:30Z Indexed on 2010/05/11 7:04 UTC
Read the original article Hit count: 424

Filed under:
|
|
|
|

My client had me deploy some folders out to a bunch of home directories for his customer websites. I did this with a Bash script, but it ended up using the root account permissions.

How do I make a Bash script that takes each folder under /home/user (not hidden files or folders), gets the user and group ownership of that folder, and then does a chown -R {user}.{group} /home/user?

The servers are running CentOS Linux.

© Server Fault or respective owner

Related posts about bash

Related posts about linux