Re: Is a "group" profile possible?

From: Juha Laiho (Juha.Laiho_at_iki.fi)
Date: 05/24/05


Date: Tue, 24 May 2005 17:29:31 +0000 (UTC)


"Chris" <ctaliercio@yahoo.com> said:
>Of course - immediately after posting this I found the 'groups' command
>for option number 2.

(or 'id', as was written in another response)

>Which would be the better practice here?
>
>[[ -r /etc/${gid}.profile ]] && ENV=/etc/${gid}.profile
>
>or
>
>[[ -r /etc/${gid}.profile ]] && . /etc/${gid}.profile

Be careful with setting 'ENV' -- it may, in some cases, cause the
designated profile file to be executed in rather unexpeted places -
making changes to the execution environment in surprising ways.

I once spent quite some time debugging a problem where a script just
couldn't find some binaries it depended on. This was on an application
account for a largish packaged application. The shell for the application
account was set to be ksh, and the initialization files were properly
configured with that in mind. However, in some occasions the application
ran some external scripts - and however well the environment was set up,
some of the applications auxiliary binaries (called in the scripts) could
not be found. At last I realised that these scripts were written in csh,
and had the csh shebang line. And there was a .cshrc file (created by
the systems default user creation tool) in the home directory which was
setting PATH to a fixed value (which of course didn't include the
application binary directories). Everything worked much more predictably
after getting rid of the .cshrc file. The risk in using ENV is very
similar -- be extremely careful in what you place into a script called
via the ENV mechanism.

-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


Relevant Pages

  • Changes to `arg - Bug in #! processing & "pear broken..."
    ... way the kernel parses #!-lines in shell scripts. ... problems with scripts that only break on FreeBSD, ... changes to the `env' command. ... split them apart for committing. ...
    (freebsd-arch)
  • /usr/bin/env program broken
    ... I run some scripts with env as the first line, ... but this does not seem to work under Solaris 9. ... and env is in /usr/bin and python is ...
    (comp.unix.solaris)
  • Re: PS1 prompt set prior to /etc/profile
    ... there aren't any PS1 lines in there. ... scripts being called from the ~/.profile. ... In any event, putting "env" ... profile. ...
    (comp.unix.solaris)
  • Re: another users env.
    ... Is there a way of finding out another (non-root) user's env. ... run the same scripts as them ... add a line to some script the run to dump them. ...
    (alt.os.linux)