Better handling of chmod, esp. as non-root users.

This includes methods for checking if the current user is root,
getting the current user's primary group name, and checks to see if the
user is root before adding chmod to a shell action.
Merge branch 'feature/chmod-nonroot' into dev