Sometimes in desperation, to test if my problem is not the permission problem I do:
sudo chmod -R 777 mydir/
In most cases it does not helps, and now I have two problems ;)
mydir/ had different permissions and owners each, and now I need to restore them to the original state.
Is there any smart way to recursive restore the permissions, except creating a backup copy? E.g.
command_to_save_the_permissions_somewhere mydir/ chmod -R 777 mydir/ command_to_restore_the_permissions_from_somewhere mydir/
BTW, any tips on debugging permission issues?