Operating System - HP-UX
1825454 Members
3927 Online
109681 Solutions
New Discussion юеВ

Permissions on /etc/profile

 
SOLVED
Go to solution
Tim Medford
Valued Contributor

Permissions on /etc/profile

Seems the default permissions on /etc/profile are set to 444. I would like to allow execute permission to the other group (ie 445).

I have a user process that needs to inherit all of the custom environment variables I set in /etc/profile. I would like to have them execute this just like a regular shell script. This seems like the easiet way to accomplish this without maintaining those variables in several locations.

Question, is there any security or other risk in changing these permissions? Did I do the right thing by setting system-wide environment variables (such as ORACLE_SID, ORACLE_HOME, etc) in /etc/profile??

Thanks in advance,
Tim
4 REPLIES 4
Mladen Despic
Honored Contributor
Solution

Re: Permissions on /etc/profile

Tim,

I think if a user process simply runs the script
/etc/profile, the process will NOT inherit the
variable assignments from the script. You will
probably need to use the "dot" command:

. /etc/profile

(that's a dot, then a space, and then the script).
If you use the "dot" command, you do not
need the execute permission on the script.
You can just leave it at 444.

Mladen
Thierry Poels_1
Honored Contributor

Re: Permissions on /etc/profile

Hi,
Mladen is right!
Personally I prefer not to edit /etc/profile too much. I only add settings which are really needed by EVERYONE. Other things like Oracle settings etc. I put in another centralized profile, which is sourced by the users who need it.
Just keep your settings centralized, never in individual scripts, users profiles, etc. : it would be an enormous work if anythings has to be changed.
regards,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Vincenzo Restuccia
Honored Contributor

Re: Permissions on /etc/profile

$HOME/.profile or /home/oracle/.profile.
Wieslaw Krajewski
Honored Contributor

Re: Permissions on /etc/profile

Hi,

Should consider two questions, what is forbidden or not and what is recommended or not.

From pure technical point ov view you can change permissions on /etc/profile and run it from the inside any other script (using dot, i.e. . /etc/profile). This is not forbidden.
But this is not recommended, as others say too.
/etc/profile, according to man 4 profile,
"... should be set op to do only those things that are desirable for every user on the system or to set reasonable defaults."
Permanent training makes master