Friday, July 13, 2018

shell - Locking Environment Variables



Is it possible to restrict the user from changing some set of environment variables?




I have have a script that sets PATH to point at a specific build of some software, and puts the user in a new bash session. I'm wondering if it's possible to make PATH (and a handful of other variables) unchangeable for that session of bash, forcing them to exit if they'd like to start changing the parts of their environment that would affect how the software runs.


Answer



This will do what you want:



readonly PATH

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...