Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to change my default shell from tcsh to bash. So I tried and this is what happened:

>sudo chsh userid
Changing the login shell for userid
Enter the new value, or press ENTER for the default
        Login Shell [/xhbin/tcsh]: /bin/bash
chsh: user 'userid' does not exist in /etc/passwd

Indeed, I am not in /etc/passwd. I don't know why.

What can I do?

share|improve this question
Is your system using distributed authentication (e.g. kerberos / winbind)? In that case your user details would not appear in the local /etc/passwd file (but should be visible using getent passwd <userid>). I think that whether running chsh is supported in that case may depend on settings in /etc/pam.d/ –  steeldriver Sep 21 '13 at 13:28
Yes that was the problem, thanks. –  rmp251 Jan 14 at 17:31
add comment

3 Answers

If you want to change the shell for your user, you do not need to become root. Just type:


without sudo and without arguments.

See also man chsh:

The chsh command changes the user login shell. This determines the name
of the user's initial login command. A normal user may only change the
login shell for her own account; the superuser may change the login
shell for any account.
share|improve this answer
The reason I used sudo was because it didn't do anything without it. > whoami userid > chsh You may not change the shell for 'userid'. –  rmp251 Jan 10 at 19:31
add comment
up vote 2 down vote accepted

My computer is part of a network using using distributed authentication so my user details would not appear in the local /etc/passwd file (but are visible using getent passwd userid). (thanks @steeldriver) In my case I had to do chsh on a core machine.

share|improve this answer
can you explain what a "core machine" is? –  Nerrve Jan 23 at 8:49
In my case I'm referring to a set of dedicated machines provided by the university inside their network that students can log into and use (shared). As opposed to my own machine in my office. –  rmp251 Jan 23 at 17:12
add comment

If you forgot your user name, you can use whoami command to remember you.

So, try with:

sudo chsh $(whoami)

If indeed, doesn't exist a line starting with your user name in /etc/passwd file (which seems inexplicable), you can add a new one like this:

username:x:1000:1000:your real name,,,:/home/username:/bin/bash

See also: Understanding /etc/passwd File Format.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.