I have a group of users on my server, "Developers", and I would like an environment variable to be set for them whenever they login.

More specifically, when anyone in this group logs in, I would like the equivalent of:

setenv ANDROID_SDK_HOME /Developers/Android/User

to be set at login. I can do this with a login script if necessary, but what I'm asking is: is it possible to set this type of thing in Profile Manager, Workgroup Manager, Directory Utility, etc?


You could use a similar approach as this solution:


Essentially, create a directory & file owned by developers with group read permissions:

chmod 0660 /etc/profile.d/developers



and add a line like this:

source /etc/profile.d/developers 2 &>1 /dev/null

Only developers will have the ability to read the file, while non developers won't see the error that they can't.


You could use "session required pam_env.so ..." in your /etc/pam.d/common-session but you'd need some logic to take care of the group stuff, perhaps from pam_succeed_if.so .

run "man pam_env" for details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.