Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

You could use a similar approach as this solution:

http://stackoverflow.com/questions/6059323/setting-user-environment-variable-and-apply-it-to-new-processes

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

/etc/profile.d/developers
chmod 0660 /etc/profile.d/developers

edit

/etc/profile 

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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