I have a debian package with static files for a web application with root:root owner. After installing this package I need to change owner of all files for tomcat:tomcat, for example. I've read that this could be done by postinst script. However I don't how I can iterate over all files of package.
I think my script should look something like this:
#!/bin/sh
set -e
USER="tomcat"
-- iterate over files
chown ${USER}:${USER} {current_file}
-- end iterate over files
I'll appreciate for any help.
Use the find command:
find . -exec chown "${USER}:${USER}" {} +
This will change the permissions recursively starting from the working directory.