Use pwd (where available) to get username (2014.1 branch)

This is #11702, cherrypicked for 2014.1.