Software

How to fix an incorrect Linux shell

If you've created new users on your Linux server and find they have the wrong shell prompt, the solution is actually quite simple. Jack Wallen shows you how to give each user a proper bash.

When you create a new user in Linux with the useradd command, it not only creates the new user, but can also generate the new user home directory, enable bash history, and a number of other necessary features for proper user functionality. But sometimes something goes wrong and you are faced with either deleting the user and recreating, or fixing the problem. One such issue I have encountered is an incorrect shell. Typically, Linux users are assigned bash as their shell. You generally know you have the right shell, when you log in and you see username@hostname: ~$. That's a fairly standard bash prompt. But what happens when that user logs in and sees nothing but a dollar sign? That means they've been assigned the wrong shell. How do you fix it? Easy. Let me show you.

Open up a terminal window and issue the command sudo nano /etc/passwd. Locate the user in question in the file and you'll probably see their listing doesn't end with the a shell entry. To switch that user to the bash shell, add /bin/bash at the end of their entry. Save and close that file. Have the user log out and log back in, and they should see the proper shell.

That's all there is to correcting an often overlooked mistake. Make sure your Linux users have the right shell prompt, so they get the full functionality of your Linux server.

linuxhero.jpg
Image: Jack Wallen

About Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.

Editor's Picks

Free Newsletters, In your Inbox