Skip to content

Permission and Ownership Backup #10

Description

@hardik4mail

We should add an option to backup of existing permission and ownership for all users.
Below is code snippet for your review.

backupdir="/root/fixperms_backups/fixperms_backups_'date +%s'"
mkdir -p $backupdir

function permsbkp
{
	local user=$1
	local home_dir=$2
	echo "Backing up permissions for $user"
	find $home_dir -printf 'chmod %#m "%p"\n' > ${backupdir}/${user}-perms_backup_'date +%s'.sh
	echo "Backing up ownerships for $user"
	find $home_dir -printf 'chown %u:%g "%p"\n' > ${backupdir}/${user}-owners_backup_'date +%s'.sh
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions