4

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?

Scott Pack
  • 14,717
  • 10
  • 51
  • 83
tmkly3
  • 141
  • 1

2 Answers2

0

You could use a similar approach as this solution:

https://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.

Stephan
  • 999
  • 7
  • 11
0

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.

Alastair Irvine
  • 1,172
  • 10
  • 22