Re: csh to sh migration for root in RELENG_14
- Reply: mike tancsa : "Re: csh to sh migration for root in RELENG_14"
- In reply to: mike tancsa : "csh to sh migration for root in RELENG_14"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 Nov 2023 18:46:20 UTC
On Fri, Nov 17, 2023 at 10:41 AM mike tancsa <mike@sentex.net> wrote: > 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. :) -- Freddie Cash fjwcash@gmail.com