Umask and redhat (updated)
Rick Stevens
rstevens at vitalstream.com
Tue Jul 20 20:46:31 UTC 2004
Waldher, Travis R wrote:
>
>
>
>>-----Original Message-----
>>From: Rick Stevens [mailto:rstevens at vitalstream.com]
>>Sent: Friday, July 16, 2004 3:43 PM
>>To: Getting started with Red Hat Linux
>>Subject: Re: Umask and redhat (updated)
>>
>>Waldher, Travis R wrote:
>>
>>>
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>From: Rick Stevens [mailto:rstevens at vitalstream.com]
>>>>Sent: Friday, July 16, 2004 2:54 PM
>>>>To: Getting started with Red Hat Linux
>>>>Subject: Re: Umask and redhat (updated)
>>>>
>>>>
>>>>
>>>>>What if your shell is chsrc, or something other than bash.
>>>>
>>>>Will this
>>>>
>>>>
>>>>>be set for them as well?
>>>>
>>>>For csh users, the lines are virtually identical in /etc/csh.cshrc.
>>>
>>>
>>>Ok, so basically there is no true global setting, I need to
>>
>>set it for
>>
>>>each type of shell?
>>
>>Yes, unfortunately. This is due to the way the shells start
>>up. bash starts up by reading, in order, /etc/profile,
>>/etc/bashrc, and ~/.bashrc among others. csh starts by
>>reading /etc/csh.cshrc, /etc/csh.login, and ~/.[t]cshrc and a
>>host of others.
>>
>>This is all due to the various permutations of Unix out there
>>(Linux being just one more), and not all of which behave the same.
>>
>>HISTORY LESSON: The first Unix shell was called, aptly
>>enough, "sh" and was written by a chap named Bourne. It's
>>more correctly called the "Bourne Shell". "bash" is an
>>enhanced version of the Bourne shell, named the "Bourne Again
>>Shell" (cute, eh?).
>>
>>If you've ever wondered why all the system admin scripts are
>>written for the Bourne or bash shells, the Unix standards
>>state that the only shell you're guaranteed to have on a
>>system is some variation of Bourne. You are also guaranteed
>>to have some other programs such as sed, ls, awk, grep, ls,
>>rm, mv, mount and cp. If you've ever wondered why those are
>>in /bin (on the root filesystem), now you know--you can be
>>sure that the root filesystem is mounted by the boot loader
>>when your admin script is run.
>>
>>You aren't guaranteed of anything else at this early stage of
>>your boot process. csh, ksh, tsh and the rest may or may not
>>be installed or on filesystems that aren't mounted yet. If
>>your script absolutely MUST work (e.g. to boot the system
>>up), you must write it for Bourne/bash.
>>
>>Ok, RECESS TIME! Who's up for a game of softball? :-)
>
>
> Ok.. So I tried making the changes, and nothing took effect, until I
> added some files to my home directory. Which tells me that at least ES
> 3.0 is reading files in the following order:
>
> /etc/profile
> /home/travis/.bash_profile
> /home/travis/.bashrc
> /etc/bashrc
>
> If .bash_profile doesn't exist under my home account, the .bashrc script
> won't run, the .bashrc script calls /etc/bashrc.
The man page states:
When bash is invoked as an interactive login shell, or as a non-inter-
active shell with the --login option, it first reads and executes com-
mands from the file /etc/profile, if that file exists. After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
in that order, and reads and executes commands from the first one that
exists and is readable. The --noprofile option may be used when the
shell is started to inhibit this behavior.
> The question becomes, short putting this entry in the /etc/profile file,
> how can I ensure umask is always run, even if there isn't any startup
> scripts in the users home directory?
The only thing guaranteed to be read at login is /etc/profile--and that
isn't read if it isn't an interactive shell. The last thing
/etc/profile does is run all "/etc/profile.d/*.sh" scripts, so you could
bury the umask stuff in there, but it still won't do anything if
/etc/profile isn't read.
With non-interactive shells (e.g. crontab entries), the value of
"$BASH_ENV" is executed instead of /etc/profile. By default, that's
set to "~username/.bashrc".
>
> Thanks,
> Travis
>
>
> _______________________________________________
> Redhat-install-list mailing list
> Redhat-install-list at redhat.com
> https://www.redhat.com/mailman/listinfo/redhat-install-list
> To Unsubscribe Go To ABOVE URL or send a message to:
> redhat-install-list-request at redhat.com
> Subject: unsubscribe
>
--
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer rstevens at vitalstream.com -
- VitalStream, Inc. http://www.vitalstream.com -
- -
- To iterate is human, to recurse, divine. -
----------------------------------------------------------------------
More information about the Redhat-install-list
mailing list