> > how can i set up the $PATH for all user at initial boot up time ?
None of these solutions will address the problem for all the existing users. The PATH variable is set by the user's shell. If the default shell is csh, there's no standard way to ensure that they get a standard know environment at login. Users can edit their own shells init files and change the environment.
ksh and sh will source /etc/profile, so that will solve your problem if you force users to only use those shells.
Or you can design and implement a "standard user environment" which maintains a standard set of shell scripts in a know place which users' default .cshrc, .login, and .logout source prior to executing their own stuff. Failure to do so means they're unsupported. This way you edit one set of files and change the environment for everyone.
Michael Vilain
The exact mechanism you use would depend on what flavor of UNIX you are using. Since you posted to the Solaris newsgroup, I am going to assume that you are using that.
This also applies to any Sys-V-based UNIX, including AIX, and to Linux & Xenix, and to some BSD-based systems:
The system-wide ".profile" for the sh, ksh and bash shells is /etc/profile. Here is where you setup the global environment common to all users, and perform actions for all users just prior to their own $HOME/.profile scripts running. In fact, you should have a default environment that works for the user even if their $HOME/.profile file is missing. The $HOME/.profile is meant for them to edit and create their own customizations that no other user would use.
For BSD-based UNIX systems, and for csh, tcsh and related shells, you'll have to do something different. At the top of every user's $HOME/.cshrc file, you have a line something like "source /etc/cshrc_global" or "source /etc/cshrc_local" or simply "source /etc/cshrc". Then you have only one file to edit to add any more aliases or common environment changes. Keep in mind that this is sourced at the start of every new subshell — even from a C-Language system() call. For actions for the user to be performed only once upon login, you have a line like "source /etc/login" at the top of every user's $HOME/.login
Notice that this latter method would work for sh-type shells too — you have a single line at the top of each user's $HOME/.profile like ". /etc/common". The weakness in this approach is that if the users can edit their own $HOME/.login, $HOME/.cshrc or $HOME/.profile, then you have to assume that they'll be friendly and nice and remember to call your script at the top every time. At least the sh-type /etc/profile method *HAS* to be run by the user when they login.
An approach I have taken in the past is to maintain a list of users separate from /etc/passwd that contain's the user's desired startup shell, and then set all users' startup shell to /bin/sh. This will force all user's to execute /etc/profile no matter what. Then at the bottom of the /etc/profile I exec a program that parses the new file, and then exec's the user's desired shell as a login shell (with a '-' character in front of the first argument, as in "-ksh", "-csh" and so on). The same /etc/profile only has action for the universal "sh" and "-sh" as I specify in the /etc/passwd file, and only exec's the new shell program if the user wants something other than "sh" as their startup shell; this avoids an infinite loop condition with /etc/profile calling /etc/profile over and over again.
Scott G. Hall