chsh

I know that chsh is used for changing your shell but I can't where this information is stored.

echo $SHELL shows bash so I know I have used the command, but I'd like to know where this is held.

Anyone know?
 
The user database, mate. Traditionally /etc/passwd but that file has long since been replaced with /etc/master.passwd.
I looked in /etc/passwd like ChatGPT suggested but there wasn't anything there, but using HI ;) it was where you suggested.

I changed it to zsh, but forget I hadn't yet installed it.

OOPS!!

Can't login.
 
When I was trying out chatgpt a while back, it insisted on using bash and I had to constantly correct it. It still hasn't learned the lesson that FreeBSD does not natively install bash. Is that the reason you are using bash?
I installed to be able to use mc. but have now replaced it zsh.
 
I looked in /etc/passwd like ChatGPT suggested but there wasn't anything there, but using HI ;) it was where you suggested.

I changed it to zsh, but forget I hadn't yet installed it.

OOPS!!

Can't login.

chsh should check the shell you select against /etc/shells, which in turn is maintained by pkg when you install shells. So this shouldn't have happened.

Unless you edited passwd in an editor and didn't go through chsh?
 
chsh should check the shell you select against /etc/shells, which in turn is maintained by pkg when you install shells. So this shouldn't have happened.

Unless you edited passwd in an editor and didn't go through chsh?
Here is my file. I don't know where these values come from and haven't even heard of some of these shells

/etc/shells :-
sh:
/bin/sh
/bin/csh
/bin/tcsh
/usr/local/libexec/git-core/git-shell
/usr/local/bin/bash
/usr/local/bin/rbash
/usr/local/bin/zsh
/usr/local/bin/rzsh

I never edit passwd.
 
Here is my file. I don't know where these values come from and haven't even heard of some of these shells

/etc/shells :-
sh:
/bin/sh
/bin/csh
/bin/tcsh
/usr/local/libexec/git-core/git-shell
/usr/local/bin/bash
/usr/local/bin/rbash
/usr/local/bin/zsh
/usr/local/bin/rzsh

I never edit passwd.
/etc/passwd is generated on editing /etc/master.passwd with vipw(8) (or with other tools like adduser(8)) using pwd_mkdb(8) for backward compatibility.

And considering risks of accidental deletion (i.e., caused by build failures of dependencies) and failed upgrades, directly setting shells from ports/pkgs as login shell would be discouraged.

FYI:
I'm configuring /bin/tcsh as login shell and have codes below in my ~/.tcshrc.mine and having blank ~/.Use_zsh.
Code:
if ( -X zsh && -f ~/.Use_zsh ) exec zsh

This way, if zsh cannot found in anywhere PATH environment variable specifies or ~/.Use_zsh does NOT exist, /bin/tcsh keeps on working as login shell, thus, doesn't fail to login.

Note that this is NOT helpful for failed upgrades (zsh in this case exists but doesn't run). I'm using this from when I was using UFS and having /usr/local as an independent partition.
And equivalent of option -X on /bin/{t}csh does NOT exist on /bin/sh.
 
When I was trying out chatgpt a while back, it insisted on using bash and I had to constantly correct it. It still hasn't learned the lesson that FreeBSD does not natively install bash. Is that the reason you are using bash?
The reason for many is probably default OS installs where the shell has no history, no normal working function keys or no command completion and the operator just wants to do some simple things without having to repeat anything all over because of a typing error. That's a crippled environment for no technical reason. Execute a working bash on a PC beyond 386, problem solved...
I have seen systems without backspace as default key meaning. Really?
 
Back
Top