fix fail invoking salt as restricted user

As commented at #5319, here is the pull request for fixing salt when invoked as non-root user / restricted account / limited shell / etc.