pixotec wrote:
I want to set the environment variables

PATH=$PATH:/usr/local/jdk-1.5.0/bin
JAVA_HOME=/usr/local/jdk-1.5.0

globally.

for one user I can change therefor .profile like this:
PATH=/usr/local/jdk-1.5.0/bin:/bin:...
...
export PATH HOME TERM

but I want it for all users:
1. could change all .profile-files of all users: no thanx ;-( (and change
/etc/skel/.profile for future new users)
2. change /etc/login.conf ???
3. create /etc/profile, change all existing .profile of users (to source
/etc/profile) and change /etc/skel/.profile
4. change /etc/ksh.kshrc and create .kshrc sourcing /etc/ksh.kshrc for all
users (and in /etc/skel...)

IS THERE A EASY WAY (change only on central file for all users) TO SET THEM?

As a centralized solution, you can use setenv in login.conf.

Or you could programatically change each user's .profile.

# for i in /home/*/.profile
> do   [[ -f $i ]] || continue
> cat << "EOF" >> $i
> export PATH=$PATH:/usr/local/jdk-1.5.0/bin
> export JAVA_HOME=/usr/local/jdk-1.5.0
> EOF
> done

If you use the script snippet, DON'T forget the quotes around the first EOF otherwise $PATH will be interpreted in the current shell, which would be root's $PATH.

-pachl

Reply via email to