From nobody Fri Nov 17 18:46:20 2023 X-Original-To: freebsd-stable@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 4SX5Th65yxz51GVQ for ; Fri, 17 Nov 2023 18:46:32 +0000 (UTC) (envelope-from fjwcash@gmail.com) Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SX5Th2Kbyz4g6k for ; Fri, 17 Nov 2023 18:46:32 +0000 (UTC) (envelope-from fjwcash@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-yb1-xb34.google.com with SMTP id 3f1490d57ef6-da30fd994fdso2883189276.1 for ; Fri, 17 Nov 2023 10:46:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700246791; x=1700851591; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BOqLbsTxMY8bewBBYjoqFbverP99+axNQmW1R9M0m38=; b=GN1KnV2igmOsfWN79gY4CJGCWW3ux70F6Mzp6OcX4UczgaFtQdfOq9/Q7AF5XbFys8 TIMr5n83UvThuTArC6SRKwsXw08E04hN6IKuP1GYkyXPryAt2x3O/fmAnEtVrlxeEkYO /fclGBbw2xTUv7C+0HIaBIXO5UtJnbjfq3FYa9ESsNYwIcgmtbnVSzJfqoTEUSXTskUa vvCsOT+7QAtReWP0PcPktB2LY7iNMXRYdEoJiv4iCf6JBWIt9n3nnX8/los5VP6Ea3qV whgYD1E7OMT9Scw2eZPrcxp/X/5FufFDweoAqMesRV+B2PLBpEouHDR7dHqkzL3JhADF gCHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700246791; x=1700851591; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BOqLbsTxMY8bewBBYjoqFbverP99+axNQmW1R9M0m38=; b=WrgCFw83moTixsC4xQILpUGgP4t9TU7o2Cj2u5p0KM1/cZsGjpjPWlEkB1PruBBAcV RrdRoL/XsPrB/qwnIwOju3aL6zLtSNuufDOBjtbKhcl074roiszIsHA+3PiK/wL6tCFG EAEx6y/q0wxccigCZwA+ppQarOkk6KLBmjGsoVaqXiwqQ8VaEQTij4YZ5Xe5NgSbhUJV 07llyv3jlKcDMiceRNI2pwdw9jjZnO+BHOOHFPIp4QD+LUknExhMXXsOPmDaaAm6Hskj /Bo3RFkfYuW7Da3wUqzrz4uIMJM1k5wT9/QhbTNYZs/FTqnZ6hwbxxBXPLpdDyzOlNSa K6EA== X-Gm-Message-State: AOJu0YyE5Z35N7KsfQRgrCSd9Vy4SIiT7QqvdGE/T7v4V4BdJjRIPE3C JLUAyHrIUYnpaKHRckAO8pzq0yKda4KBHdV2sHE= X-Google-Smtp-Source: AGHT+IER7tNAhiR7Yzf3zFAH3SXKx+N0rO8o/GDnKe8vnVNNmGmv6zWL8CXyJSuUGHfy5S8eM+VIGmJ285kG78niIDE= X-Received: by 2002:a25:3356:0:b0:da0:454d:cf57 with SMTP id z83-20020a253356000000b00da0454dcf57mr3826308ybz.16.1700246790936; Fri, 17 Nov 2023 10:46:30 -0800 (PST) List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 References: <6c6add3c-4a5e-4d84-9964-9a9448a36c95@sentex.net> In-Reply-To: <6c6add3c-4a5e-4d84-9964-9a9448a36c95@sentex.net> From: Freddie Cash Date: Fri, 17 Nov 2023 10:46:20 -0800 Message-ID: Subject: Re: csh to sh migration for root in RELENG_14 To: mike tancsa Cc: FreeBSD-STABLE Mailing List Content-Type: multipart/alternative; boundary="000000000000011e72060a5d8e77" X-Spamd-Bar: ---- 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:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4SX5Th2Kbyz4g6k --000000000000011e72060a5d8e77 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Nov 17, 2023 at 10:41=E2=80=AFAM mike tancsa wrot= e: > I am trying to bring my environment along from previous versions where > csh was the default shell and now trying to get used to sh. In the past > things like > > sudo su > > would pick up my settings in /root/.cshrc automatically. However, with > sh I have to do > > sudo su -l root > > Is there a way to configure it so I dont need the -l as part of the su > to get the same behavior ? > > > e.g. > > - 0 mike@mfitest1:~ $ su > Password: > # ^D > - 0 mike@mfitest1:~ $ su -l root > Password: > - 0 root@mfitest1:~ # > > with su -l root, I get all the settings I have in .profile. Without '-l > root', I am not sure what is getting set from where. But its different > as I can see it in the prompt being different ? > su by itself just switches your username, it doesn't pick up the rest of the environment settings like a proper login does. su - is what you are looking for, as that simulates a real login, picking up all the environment settings of the new user. sudo su - The reason it "worked" before is that you were changing shells when changing users, so it would read the shell startup config files. But it was still using the environment of the previous user. Now that both users are using the same shell, you have to force the "simulate login" part. Check the output of things like PATH and HOME and what not between your normal user and switching users via: sudo su sudo su - You'll be (mildly?) surprised by the output. :) --=20 Freddie Cash fjwcash@gmail.com --000000000000011e72060a5d8e77 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Nov 17, 2023 at 10:41=E2=80=AFAM = mike tancsa <mike@sentex.net> = wrote:
I am trying to bring my environment along from previous v= ersions where
csh was the default shell and now trying to get used to sh. In the past things like

sudo su

would pick up my settings in /root/.cshrc automatically. However, with
sh I have to do

sudo su -l root

Is there a way to configure it so I dont need the -l as part of the su
to get the same behavior ?


e.g.

- 0 mike@mfitest1:~ $ su
Password:
# ^D
- 0 mike@mfitest1:~ $ su -l root
Password:
- 0 root@mfitest1:~ #

with su -l root, I get all the settings I have in .profile. Without '-l=
root', I am not sure what is getting set from where. But its different =
as I can see=C2=A0 it in the prompt being different ?
=
su by itself just switches your username, it doesn't pic= k up the rest of the environment settings like a proper login does.
su - is what you are looking for, as that simulates a real login, pickin= g up all the environment settings of the new user.

sudo su -

The reason it "worked" before= is that you were changing shells when changing users, so it would read the= shell startup config files.=C2=A0 But it was still using the environment o= f the previous user.=C2=A0 Now that both users are using the same shell, yo= u have to force the "simulate login" part.

Check the output of things like PATH and HOME and what not between your = normal user and switching users via:
sudo su
sudo su -<= /div>

You'll be (mildly?) surprised by the output.= =C2=A0 :)


--
Fre= ddie Cash
fjwcash= @gmail.com
--000000000000011e72060a5d8e77--