From nobody Fri Dec 08 13:00:40 2023 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SmrqF6PZkz53x2m for ; Fri, 8 Dec 2023 13:00:57 +0000 (UTC) (envelope-from fbsddev@bsd2.de) Received: from servers.bsd2.de (servers.bsd2.de [IPv6:2a0a:51c0:0:155::2b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "servers.bsd2.de", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SmrqF2J87z4Q55 for ; Fri, 8 Dec 2023 13:00:57 +0000 (UTC) (envelope-from fbsddev@bsd2.de) Authentication-Results: mx1.freebsd.org; none Received: from servers.bsd2.de (servers.vpn [IPv6:fd11:13bc:e33d:ffff:0:0:200:20]) by servers.bsd2.de (8.17.1/8.17.1) with ESMTPS id 3B8D0eSe032089 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 8 Dec 2023 14:00:41 +0100 (CET) (envelope-from fbsddev@bsd2.de) Date: Fri, 8 Dec 2023 14:00:40 +0100 From: fbsddev@bsd2.de To: LuMiWa Cc: FreeBSD Questions Subject: Re: sh shell Message-ID: References: <20231208052849.00987310@dismail.de> List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231208052849.00987310@dismail.de> X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:48314, ipnet:2a0a:51c0::/32, country:DE] X-Spamd-Bar: ---- X-Rspamd-Queue-Id: 4SmrqF2J87z4Q55 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 [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 >