Search code examples
javabashshellrheluser-management

Permanently set environment variables for Multiple users


Java build machine is on Redhat 7.5 to run mvn clean package deploy for building Java code.

Multiple users login with their username to this build machine, to build Java code.

To permanently set JAVA_HOME & update PATH environment for all users,

Updating /etc/profile needs sudo source /etc/profile for every login, by every user. All users are part of wheel group

Edit:

Using sudo on internal command is invalid


How to permanently set these variables, for every login?


Solution

  • Editing /etc/profile should work, but not recommended. you should create a new file in /etc/profile.d/ and set the JAVA_HOME there with export.