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.
- How to easily add an SSH fingerprint to your known_hosts file in Linux (TechRepublic)
- How to run a network speed test from a headless Linux server (TechRepublic)
- How to send messages to users logged into your Linux machines (TechRepublic)
- How to use the nmcli command to gather network device information on Linux (TechRepublic)
- How to add a repository on your Linux machine (TechRepublic Video)
- The most popular Linux desktop programs are... (ZDNet)
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.