Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2000 23:24:50 +0100 (CET)
From:      Oliver Fromme <olli@dorifer.heim3.tu-clausthal.de>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Re: window manager question
Message-ID:  <200001052224.XAA37273@dorifer.heim3.tu-clausthal.de>
In-Reply-To: <8508ft$1pmi$1@atlantis.rz.tu-clausthal.de>

next in thread | previous in thread | raw e-mail | index | archive | help
R Joseph Wright <rjoseph@nwlink.com> wrote in list.freebsd-questions:
 > Does this mean that generally I should never login as root, even for
 > example when installing a new port?  I should do su instead?

Yes, exactly.

This is especially important on machines which have more than
one admin.   When you use su, it is much easier to track
changes to the system and find out who did what.  When you
login as root, you're working "anonymously".  This can be
dangerous, and is generally not desirable.

I usually configure all virtual terminals as "insecure", so
it's impossible to login as root.  ;-)  (ssh and ftp don't
allow root logins by default, and telnet is disabled on most
of the FreeBSD boxes here.)

I also prefer to compile ports as normal user (/usr/ports is
writable by members of the wheel group), and only do the
"make install" as root.  However, this is a bit inconvenient,
because dependencies don't work right (they fail to install
automatically as normal user, of course, so you have to do
that manually as root).  Not a big deal, though.

 > If that's
 > the case, is there an rc file that I can use to get my su shell to
 > behave as my user shell?  For example, I like for the prompt to show my
 > user name and current working directory.

When you use ``su -m'', your shell will read the standard
rc files, so you should get identical behaviour.  Note that
it will _not_ read the login profile, because it is not a
login shell (for example, if you use zsh, then ~/.zprofile
will not be read, but ~/.zshrc will be read).

Personally, I like to have a different prompt when I'm root,
therefore my ~/.zshrc (I'm using zsh) contains this (among
other stuff):

if [[ $EUID -eq 0 ]]; then
        PROMPT="%Broot%b@%m:%4(~:...:)%3c%B#%b "
else
        PROMPT="%n@%m:%4(~:...:)%3c> "
fi

This will give me a nice bold ``root'' in the prompt, so I
never forget that I have to be careful not to type rm -rf /
and kill -9 -1 and things like that.  ;-)

Regards
   Oliver

-- 
Oliver Fromme, Leibnizstr. 18/61, 38678 Clausthal, Germany
(Info: finger userinfo:olli@dorifer.heim3.tu-clausthal.de)

"In jedem Stück Kohle wartet ein Diamant auf seine Geburt"
                                         (Terry Pratchett)


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001052224.XAA37273>