I was assigned an account for log in to a remote server, and I want to change my default shell.
I tried chsh
command but it says: chsh: "/public/home/{my_id}/bin/zsh" is not listed in /etc/shells.
CodePudding user response:
- First check all the shells available on your linux system
cat /etc/shells
- Use chsh command line utility for changing a login shell with the -s or –shell option like this.
# chsh --shell /bin/sh tecmint
CodePudding user response:
If you don't have permission to install zsh system wide, a quick fix is to append exec ~/bin/zsh -l
to ~/.bash_profile
(if bash is the current shell), or an equivalent rc file for the current login shell.
zsh -l
starts zsh as a login shell.exec COMMAND
replaces the current process with COMMAND, so you'll only have to type exit (or press ctrl d) once.~/.bash_profile
is executed when bash starts as a login shell, you can still run commandbash
normally.
Depending what is in ~/.bash_profile
(or equivalent), you may wish to avoid executing its other contents, by putting exec ~/bin/zsh -l
at the start of the file (not the end), and copy/port anything important over to the zsh equivalent, $ZDOTDIR/.zprofile
.
I might also do export SHELL="$HOME/bin/zsh"
, although I'm unsure of the full effects of setting SHELL differently to that specified for your user in /etc/passwd
, to a shell not in /etc/shells
, and to a shell binary in your home path.