chsh -s /bin/tcsh and you (user) don’t exist error

Sometimes, you are a non-root user and you wish to change shell and you have an error

$ chsh -s /bin/tcsh
chsh you (user xxxxxxxxx) don't exist

This error occurs when the userID and Passowrd is using LDAP or Active Directory so there is no local account in the /etc/passwd where it first looks to. I used Centrify where we can configure the Default Shell Environment on AD. But there is a simple workaround if you do not want to bother your system administrator

First check that you have install tcsh. I have it!

$ chsh -l
/bin/bash
/bin/cdax/bash
/bin/cdax/csh
/bin/cdax/ksh
/bin/cdax/rksh
/bin/cdax/sh
/bin/cdax/tcsh
/bin/csh
/bin/ksh
/bin/rksh
/bin/sh
/bin/tcsh
/sbin/nologin
/usr/bin/bash
/usr/bin/cdax/bash
/usr/bin/cdax/dzsh
/usr/bin/cdax/sh
/usr/bin/dzsh
/usr/bin/sh
/usr/sbin/nologin
/usr/bin/tmux

Next Step: Check your current shell

$ echo "$SHELL"
/bin/bash

Step 3: Write a simple .profile file

$ vim ~/.profile
if [ "$SHELL" != "/bin/tcsh" ]
then
    export SHELL="/bin/tcsh"
    exec /bin/tcsh -l    # -l: login shell again
fi

Step 4: In your .bashrc, just add the “source ~/.profile”

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

source ~/.profile

Source the .bashrc again

$ source ~/.bashrc