-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Andreas Hanke wrote:
John schrieb:
In order to run this app and read its manual, I need to add the relevant directories to PATH and MANPATH respectively, but if I use the 'export' command, it only adds them or the current session.
How can I add these two paths permanently for all users?
Use /etc/profile.local.
This file does not exist in a default installation. Just create it, write your stuff into this file and it will be picked up for all subsequent logins of all users.
Indeed.
e.g.:
- ---8<----------------------------------------------
PATH=/opt/app/bin:$PATH
MANPATH=/opt/app/man:$MANPATH
export PATH MANPATH
- ---8<----------------------------------------------
An alternative notation (but bash specific):
- ---8<----------------------------------------------
export PATH=/opt/app/bin:$PATH
export MANPATH=/opt/app/man:$MANPATH
- ---8<----------------------------------------------
Though there's normally no need to export them, as they have already
been marked as exported in /etc/profile, so this should be sufficient:
- ---8<----------------------------------------------
PATH=/opt/app/bin:$PATH
MANPATH=/opt/app/man:$MANPATH
- ---8<----------------------------------------------
But better mark them as export again, just to make sure ;)
Anyhow, another option is to put it as a separate file under
/etc/profile.d/ with a filename that ends in ".sh"
Basically, what /etc/profile does:
- - looks for /etc/profile.local - if it exists, it sources it
- - looks for files as /etc/profile.d/*.sh - and sources those that are
readable
The interesting thing with /etc/profile.d/*.sh is that you can select
what users will get the stuff that's in there through user/group and
access rights.
e.g. if you want some variables/exports/functions/aliases to only be
defined for a certain group of people, you can:
- - create a group for them (groupadd or in yast), e.g. "staff"
- - put those people in that group
- - create e.g. /etc/profile.d/staff-functions.sh
- - put the export/function/alias definitions in there (e.g. the PATH and
MANPATH stuff as above)
- - chown root:staff /etc/profile.d/staff-functions.sh
- - chmod 0040 /etc/profile.d/staff-functions.sh
cheers
- --
-o) Pascal Bleser http://linux01.gwdg.de/~pbleser/
/\\