Newbie Question: Where does PATH get set?

Newbie Question: Where does PATH get set?

Post by Jim Campbel » Tue, 14 Dec 1999 04:00:00



I did a "make install" on the Bash-2.03 port (my first port install).
The make went smoothly and I followed the advice on adding bash to my
shells database. I also used chpass -s to change the default shell for
both my account and root. My problem is that the ../sbin directories are
no longer in my path so I now have to fully specify commands like ping
and halt. Using env confirms that my PATH variable does not contain
these directories.   I have checked the bash man pages and FAQ.
According to the man page:

"When Bash is invoked as an interactive login shell, it first reads and
executes commands 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. "

My OpenBSD 2.5 install doesn't have /etc/profile (or ~/.bash_profile',
`~/.bash_login' of course)  and the ~/.profile files PATH reference
don't have the sbin directories in them. Where does sh find them? How
should I configure bash to set PATH properly? Any other tweaks I need to
get bash integrated properly?

Thanks

Jim Campbell

--

 
 
 

Newbie Question: Where does PATH get set?

Post by Jim Campbel » Tue, 14 Dec 1999 04:00:00


I did a "make install" on the Bash-2.03 port (my first port install).
The make went smoothly and I followed the advice on adding bash to my
shells database. I also used chpass -s to change the default shell for
both my account and root. My problem is that the ../sbin directories are
no longer in my path so I now have to fully specify commands like ping
and halt. Using env confirms that my PATH variable does not contain
these directories.   I have checked the bash man pages and FAQ.
According to the man page:

"When Bash is invoked as an interactive login shell, it first reads and
executes commands 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. "

My OpenBSD 2.5 install doesn't have /etc/profile (or ~/.bash_profile',
`~/.bash_login' of course)  and the ~/.profile files PATH reference
don't have the sbin directories in them. Where does sh find them? How
should I configure bash to set PATH properly? Any other tweaks I need to
get bashintegrated properly?

Thanks

Jim Campbell

--

 
 
 

Newbie Question: Where does PATH get set?

Post by James Grav » Wed, 15 Dec 1999 04:00:00



Quote:>I did a "make install" on the Bash-2.03 port (my first port install).
>The make went smoothly and I followed the advice on adding bash to my
>shells database. I also used chpass -s to change the default shell for
>both my account and root.

                     ^^^^
This is probably not a good idea for two reasons:

        1) If bash is still in /usr/local/bin, and the /usr partition
        gets corrupted, you can't log in as root.  Better to put bash in
        /bin, because the root filesystem doesn't change much, and is
        less likely to suffer a corruption after a system crash.

        2) Bash, with the default compile options in the ports tree, is
        not statically linked.  This means that if something goes wrong
        with one of your system libraries, you won't be able to run
        bash, so you won't be able to log in as root to fix it.

I usually do use bash for interactive shells, including for root.  For
my normal user account, it's the shell in my password entry.  For root,
the default login shell is still ol' /bin/csh, and I run this after
logging in:
        exec /bin/bash --login

I don't make it the default for reason #2 above.  Much safer that way.

As for root's PATH, I almost always explicitly specify it in my .profile
or whatever.  I usually need to add some less commonly used directories
like /root/bin and /usr/local/sbin to my PATH anyway.

James Graves

--
_______________________________________________________________________________
http://www.xnet.com/~ansible                       Rapture.  Be Pure. - Blondie

 
 
 

Newbie Question: Where does PATH get set?

Post by Dennis Dav » Wed, 15 Dec 1999 04:00:00




>>I did a "make install" on the Bash-2.03 port (my first port install).
>>The make went smoothly and I followed the advice on adding bash to my
>>shells database. I also used chpass -s to change the default shell for
>>both my account and root.
>                     ^^^^
>This is probably not a good idea for two reasons:

...

Quote:>    2) Bash, with the default compile options in the ports tree, is
>    not statically linked.  This means that if something goes wrong
>    with one of your system libraries, you won't be able to run
>    bash, so you won't be able to log in as root to fix it.

>I usually do use bash for interactive shells, including for root.  For
>my normal user account, it's the shell in my password entry.  For root,
>the default login shell is still ol' /bin/csh, and I run this after
>logging in:
>    exec /bin/bash --login

>I don't make it the default for reason #2 above.  Much safer that way.

This is almost exactly what I do.  However if you can't stand csh,
try changing root's shell to /bin/sh.  This is ksh in disguise and
it is statically linked.  So the above objections (2) don't really
apply.  You can even make ksh look a bit like bash.  This has been

http://www.uk.openbsd.org/faq/faq2.html#2.2

for details of OpenBSD mailing lists.
--
Dennis Davis, BUCS, University of Bath, Bath, BA2 7AY, UK

 
 
 

Newbie Question: Where does PATH get set?

Post by Jim Campbel » Wed, 15 Dec 1999 04:00:00





I didn't get James' message


> >>I did a "make install" on the Bash-2.03 port (my first port install).
> >>The make went smoothly and I followed the advice on adding bash to my
> >>shells database. I also used chpass -s to change the default shell for
> >>both my account and root.
> >                     ^^^^
> >This is probably not a good idea for two reasons:

OK, I will take a look at this.

Quote:> ...

> >       2) Bash, with the default compile options in the ports tree, is
> >       not statically linked.  This means that if something goes wrong
> >       with one of your system libraries, you won't be able to run
> >       bash, so you won't be able to log in as root to fix it.

> >I usually do use bash for interactive shells, including for root.  For
> >my normal user account, it's the shell in my password entry.

Do you edit the profile file to add the ../sbin directories to the PATH
for each user? I just assumed there was some global environment variable
or file from which I could reference to configure the PATH correctly in
either the .bash_profile or the .bash_login file.

  For root,

Quote:> >the default login shell is still ol' /bin/csh, and I run this after
> >logging in:
> >       exec /bin/bash --login

> >I don't make it the default for reason #2 above.  Much safer that way.

 > This is almost exactly what I do.  However if you can't stand csh,

> try changing root's shell to /bin/sh.  This is ksh in disguise and
> it is statically linked.  So the above objections (2) don't really
> apply.  You can even make ksh look a bit like bash.  This has been

> http://www.uk.openbsd.org/faq/faq2.html#2.2

> for details of OpenBSD mailing lists.

I have only been browsing the newsgroup comp.unix.bsd.openbsd.misc. Are
there articles that appear in the mail list that are not in the
newsgroup?

> Dennis Davis, BUCS, University of Bath, Bath, BA2 7AY, UK


--

Thanks for the information.

Jim Campbell

 
 
 

Newbie Question: Where does PATH get set?

Post by James Grav » Wed, 15 Dec 1999 04:00:00



Quote:>Do you edit the profile file to add the ../sbin directories to the PATH
>for each user? I just assumed there was some global environment variable
>or file from which I could reference to configure the PATH correctly in
>either the .bash_profile or the .bash_login file.

Yes, there are system-wide config files.  For sh and sh-derived shells
(ksh, bash, zsh, etc.) you need to edit /etc/profile.  And for csh
shells /etc/csh.login or /etc/.login and sometimes /etc/csh.cshrc (it
depends on the system type).  

I'm usually logging into many different systems, so it's quicker for me
to just edit my personal startup files instead of changing each system.
If I'm in a really diverse environment, my login script will actually
look something like this:

if [ -d /usr/local/bin ];  then PATH=$PATH:/usr/local/bin; fi
if [ -d /usr/local/sbin ]; then PATH=$PATH:/usr/local/sbin; fi

... etc.

Takes a little longer to log in, but then CPU power is cheap these
days.  Have to watch out for hung NFS mounts, though.

James Graves
--
_______________________________________________________________________________
http://www.xnet.com/~ansible                       Rapture.  Be Pure. - Blondie

 
 
 

1. Newbie Question:how to set path?

Hi, I tried to modify my path variable, and I tried
set path=$path:$HOME/bin But it doesn't work! I tried to add braces to the
variables too, but the result is something like "set variable must begin
with a letter."

What's wrong? Please help, thanks.

Xiaoyi

--
/==========================================================================\
|  Xiaoyi Wu        || "I don't have any solution, but I certainly         |


\~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/

2. storage solution

3. a newbie question -how to set my own lib and include path

4. Help installing Linux

5. set path = "$path" hoses path in tcsh -- why???

6. Ballmer Mouths off about mounting XP criticism

7. Setting path when doing 'su' to root...

8. Question about native 1.4.1, InetAddress.getLocalHost() - bug?

9. Newbie: getting path to shell script

10. How to convert a dos path to unix path on Sys V?

11. newbie: setting PATH in .profile

12. need general help with setting paths & man paths for apps

13. PATH set by "rsh localhost echo \$PATH"