1

I've a condition in which I want to restrict a unix user from setting up environment variables or modifying the environment variables locally during the user's active unix session.

For example, if I've set my JAVA_HOME='/usr/java' then the user might not be able to change/modify it during his login.

I did a workaround of restricting via /etc/security/limits.conf, but this type of restriction can restrict the use of that command locally. I don't want to restrict the use of that command(export in this case), rather restrict the use of that command for modifying the environment variables.

Any ideas?

0
1
export MYENV=value
readonly MYENV

Check Protected environment variables? (also on unix.stackexchange.com)

2
  • This is shell-dependent. In bash this is permanent. zsh lets you undo this. – hymie Oct 7 '15 at 11:02
  • 2
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Michaël Oct 12 '15 at 5:41

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.