Use pwd (where available) to get username

This fixes an issue with username detection on FreeBSD. See [here](https://github.com/saltstack/salt/issues/11628#issuecomment-39245443) for more information.

Resolves #11628.