Reading Time: < 1 minute

Hi All, this document shows you how to switch default bash shell to zsh for an active directory user.

By default, all the Linux users are created with bash as their default shell.  You can change your shell  using below command,

chsh -s /bin/bash

or you can change in /etc/passwd file also.

It’s a bit complicated when you use LDAP authentication for your Linux laptop. Why it is complicated means user details are not stored in /etc/passwd file.

In order to change the shell for an LDAP authenticated user from bash to zsh, I found below is the dirty fix. Add the following statement in the .bashrc file.

 

if [ -x /usr/bin/zsh ]; then
echo 'starting zsh'
# export SHELL=/bin/zsh #edit: this is probably not what you want, see the comment.
exec /usr/bin/zsh
fi

 

After this, any new terminal sessions will be opened with zsh as their default shell.

 

© 2020, Techrunnr. All rights reserved.

#1
#2
#3
Questions Answered
Articles Written
Overall Points
Categories: Linux

Prabhin Prabharkaran

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!

0 Comments

Leave a Reply