On Fri, Jul 10, 2026 at 03:44:53PM -0400, Todd Gruhn wrote:
> I thing I found a prob:
> 
> In /etc/shrc , there is a line that sets PS1 (I am hacking on that).
> Is it possible to chance or remove that? Comment out?

In general you should leave files like /etc/shrc and /etc/profile alone.
These are system-wide shell startup files which affect the login of all
users.

Typically people will create their own .profile or/and .kshrc or other
shell profile to customize things for their own preferences.

> I have PS1 set in .kshrc ...

For ksh in particular you should read the ksh(1) man page (ie. 'man
ksh') or related online docs to understand which files are sourced and
in what order, to affect shell configuration and behavior.

There is usually a man page section called "FILES" which lists them, but
the conditions and ordering may be defined elsewhere in the docs.

Note that the profile file(s) sourcing may be different depending on how
you login. Eg. 'su' can be different from 'su -' and can be different
from logging in directly as root (or other user) with password.

It should be obvious, but JIC: ~root/.kshrc is (or should be) a separate
file from eg. ~tgruhn2/.kshrc .

In any case, Ksh isn't specifically a NetBSD topic, there is a lot of
info, docs, examples about Ksh and other Linux/Unix/BSD shells online.
It may be helpful to spend some time there, especially if you're just
getting started with Ksh.


> On Fri, Jul 10, 2026 at 2:06 PM Steve Rikli <[email protected]> wrote:
> > On Fri, Jul 10, 2026 at 12:15:38PM -0400, Todd Gruhn wrote:
> > > I checked /etc/passwd :
> > > root:*: . . .:/bin/ksh
> >
> > That indicates your root login is already using ksh, so that's the shell
> > you'll be in if you su, eg.
> >
> > $ su
> > Password:
> > # echo $SHELL
> > /bin/ksh
> >
> > > In /root ; dont have .ksh ; need to make that?
> >
> > You don't strictly need .kshrc just to use ksh; that file (and others)
> > is used to customize the shell settings and behavior to your taste. Note
> > that ksh will also source ~/.profile and the system-wide /etc/profile
> > files. The man page can help explain the behavior.
> >
> > I haven't regularly used Ksh in quite a while but it's not hard to find
> > docs and examples online about Ksh and .kshrc along with the default
> > NetBSD ksh(1) man page.
> >
> > On Fri, Jul 10, 2026 at 12:17:53PM -0400, Todd Gruhn wrote:
> > > IN /etc/passwd.BAK :
> > > root:*: ... /bin/sh
> > >
> > > Did I mess this up?
> >
> > No. /etc/passwd.BAK is presumably a backup copy of /etc/passwd. It's not
> > typically used in normal activity.
> >
> > If you didn't create it yourself you may want to compare them JIC, eg.
> >
> > diff /etc/passwd.BAK /etc/passwd
> >
> > If this is a system someone else setup, they may have simply made a copy
> > before changing things.
> >
> >
> > > On Thu, Jul 9, 2026 at 11:47 PM Steve Rikli <[email protected]> wrote:
> > > > On Thu, Jul 09, 2026 at 10:44:04PM -0400, Todd Gruhn wrote:
> > > > > So, I start NetBSD or su to root, I
> > > > > need to do ' . ./.ksh'.
> > > > >
> > > > > Why cant I get /bin/ksh when I login?
> > > > >
> > > > > I found /etc/shrc. Does this have something
> > > > > to do with this? Make a /etc/kshrc ?
> > > >
> > > > Are you saying you want to login or su as root and you want the shell
> > > > to automatically be ksh?
> > > >
> > > > Before making any changes, you can check your system's root user shell
> > > > by looking at root's line in /etc/passwd .
> > > >
> > > > $ grep ^root: /etc/passwd
> > > > root:*:0:0:Charlie &:/root:/bin/sh
> > > >
> > > > If you really want to change this, one method is running the NetBSD
> > > > 'sysinst' command as root, navigate to "Config menu", then "Root shell",
> > > > and select the shell you prefer.
> > > >
> > > > There's no need to create /etc/kshrc to use ksh as a login shell, or
> > > > to run it manually from the commandline.
> > > >
> > > > E.g. if you want to temporarily switch shells from the commandline, you
> > > > should be able to simply type '/bin/ksh'.

Reply via email to