maozet's blog

File Permission Backup Howto?

Have you ever mistakenly changed a directory permission?

Well, I guess that happens to all once in a while(even couple of years).

So, Following is a short tutorial about how to back up your permissions for latter recovery.

The idea is very simple:
* Create a permission back up file named: myperbackup.sh (based on arg $2)
* Loop over the path to backup
* For each file store the:
chmod command and the old permission bits
chown command and the user.group

Note:
Its a good idea to place that in cron.

Syndicate content