Merge #2692: Use pam_env to properly setup system-wide env

(cherry picked from commit 18a0cdd86416a8cbc263cfa8cb96c460a53f7b5c)