Configuring Bash

Montag montag at
Thu May 15 01:10:31 UTC 2008

> ### SNIP ###
> Are you saying it works if you:
> su - root

Yes, that's correct.

> But logging in as a regular user.  So, can you:
> login as a regular user
> su - root
> su - [regular user]

Interesting, this produces the correct output.

Login   :   ${PS1} $ $                   (Wrong)
su-root :   [root at host-- /home/user]#    (Correct)
su-user :   [user at host-- ~]$             (Correct)
exit    :   [root at host-- /home/user]#    (Correct)
exit    :   ${PS1} $ $                   (Wrong)

This does not really jive with what I read in the man pages.  It said
that .bash_login is invoked during login, while .bashrc is used when an
interactive shell that is not a login shell is started.  Currently I do
not even have a .bashrc defined, so the only thing that should be
getting used is .bash_profile.  Why does su invoke .bash_profile?

The relevant entries from /etc/password are:
root:*:0:0:Charlie &:/root:/usr/local/bin/bash
user:*:1001:0:User &:/home/user:/usr/local/bin/bash

"Give the people contests they win by remembering the words to more popular songs or the names of state capitals or how much corn Iowa grew last year. Cram them full of non-combustible data, chock them so damned full of 'facts' they feel stuffed, but absolutely 'brilliant' with information. Then they'll feel they're thinking, they'll get a sense of motion without moving."

More information about the freebsd-questions mailing list