#!/bin/bash #set -x fixperms() { echo "FIXING $SUFFIX in $@ $(date)" cd "$3""$SUFFIX" IFS=$'\t' ssh "$1" -- 'find '"$2$SUFFIX"' -printf "%m\t%U:%G\t%u:%g\t%P\n"' | tail -n +2 | while read -a line; do #echo chown -h "${line[2]}" "${line[3]}" #set name ids (probably bad for migrations?) chown -h "${line[1]}" "${line[3]}" #set numeric ids test -L "${line[3]}" || chmod "${line[0]}" "${line[3]}" #set mode if not symlink done; } #SUFFIX=/home time fixperms server.example.com /vzdaleny/adresar/ /lokalni/adresar/