Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Dec 2023 14:00:40 +0100
From:      fbsddev@bsd2.de
To:        LuMiWa <lumiwa@dismail.de>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: sh shell
Message-ID:  <ZXMTeDivImWjTmHW@servers.bsd2.de>
In-Reply-To: <20231208052849.00987310@dismail.de>
References:  <20231208052849.00987310@dismail.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Did you check the shell for root in your /etc/passwd with vipw?
The default shell of root was tcsh before sh. Maybe that has not been updated
on your system.

And you need the dash after su ( su - ) for a "full" login, which should read
the correct rc file for the login shell and give you a clean environment for
root.

The manpage of su states:

     -       (no letter) The same as -l.

     -l      Simulate a full login.  The environment is discarded except for
             HOME, SHELL, PATH, TERM, and USER.  HOME and SHELL are modified
             as above.  USER is set to the target login.  PATH is set to
             “/bin:/usr/bin”.  TERM is imported from your current environment.
             Environment variables may be set or overridden from the login
             class capabilities database according to the class of the target
             login.  The invoked shell is the target login's, and su will
             change directory to the target login's home directory.  Resource
             limits and session priority are modified to that for the target
             account's login class.

Hope that helps.
Regards,
T.


* LuMiWa <lumiwa@dismail.de> [2023-12-08 05:28:49 -0500]:

> Hi!
> 
> I have FreeBSD 14.0-RELEASE-p2. Root shell is sh and user ksh.
> In the root directory is .shrc and .sh_history which settings using if I
> log as root or su -. But if I use just su if as I read should use also
> root settings but it doesn't. It use .cshrc. Is it correct or I have
> somewhere wrong setting, please?
> 
> env
> LOGNAME=abc
> A__z="*SHLVL
> PAGER=less
> LANG=en_US.UTF-8
> COLORFGBG=10;default;0
> XAUTHORITY=/home/abc/.Xauthority
> MAIL=/var/mail/abc
> PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/abc/bin
> EDITOR=vi
> ENV=/home/abc/.kshrc
> DISPLAY=:0
> PWD=/home/abc
> _=clear
> TERM=rxvt-unicode-256color
> USER=abc
> HOME=/root
> WINDOWPATH=9
> SHELL=/bin/sh
> COLORTERM=rxvt-xpm
> MM_CHARSET=UTF-8
> WINDOWID=27263125
> BLOCKSIZE=K
> SHLVL=2
> 
> Thank you.
> 
> -- 
> “Life shrinks or expands in proportion to one's courage.”
> ― Anais Nin 
> 



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