move getting uid and gid to its own method

setPermissions really did two separate things which had no
reason to be in the same method.
rename getPermissions to getOwnership

although the code was part of setPermissions it actually only
gets the user and group id so it doesn't do anything with
permissions.
an actual getPermissions that could fetch permissions for each
individual file would be good to have at some point.
add parameter to choose shell privileges for getOwnership

while stat works without su on directories it needs su for
single files.
also, writing to error log is added to getOwnership.