find isn't able to ‘restore initial working directory’ when run behind
sudo -u if the initial working dir is not visible to the user find runs as. This causes find to always print an annoying Permission denied warning message:
$ pwd /home/myuser $ sudo -u apache find /home/otheruser -writable find: failed to restore initial working directory: Permission denied
What is the best way to prevent find from printing this message?
One method is to change to a directory that the find user can restore, such as
cd /, before running find. Ideally, I'd just like an option for find such as
--do-not-restore-initial-working-directory but I guess that's not available. ;)
I'm mostly using RedHat-based distributions.