Choose a Login Shell
Choose a Login Shell
When an assistant begins a terminal login, the account's shell field helps determine which program starts. A shell interprets commands; different shells can have different syntax and startup rules. Selecting a path in the account record is therefore more than choosing a label.
We will configure Bash for the practice account. Before doing that, make sure the executable exists on this machine and is appropriate under the local policy. Recording a path does not install the program or guarantee that a login can launch it.
What you’ll learn
- Inspect and change an account’s configured login shell.
- Verify that the selected shell is installed and permitted by local policy.
The account points to an executable shell
Installed program
Confirm the intended shell exists on this system.
/bin/bashAccount field
usermod -s selects the configured shell path.
shell = /bin/bashLogin behavior
Login launches that shell under local policy; setting a path does not install it.
usable executable required
Choose an installed shell for the assistant
Prepare the example
Use the disposable VM and the existing assistant account. Confirm /bin/bash is installed and inspect the system's permitted-shell configuration where applicable. Keep another administrative recovery session available rather than experimenting on your only working login.
Bash · Linux terminal
sudo usermod -s /bin/bash school-assistant
getent passwd school-assistantExpected behavior; machine-dependent details
The final account field contains the selected shell path.usermod -s /bin/bash school-assistant selects the shell field with -s. The final argument identifies the account being changed. getent passwd school-assistant lets you inspect the record afterward and locate the configured shell path.
The new field affects future startup according to the login mechanism; it does not turn every already-running shell into Bash. Some systems use a non-login program in this field for service accounts, which is a different purpose from interactive command work. Choose the field based on the account's role rather than treating one shell as the mandatory setting for every user.
Inspect the current and available shell programs
A login shell is the command interpreter started for an interactive user session. Common examples include Bash, Zsh and Fish.
What is a login shell?
A login shell is the command-line interface that starts when you log into your Linux account. It can be Bash, Zsh, Fish, or any shell listed in /etc/shells.
Step 1: Check your current shell
To check what shell you're using right now, run:
echo $SHELL
You’ll get an output like:
/bin/bash
Step 2: View available shells on your system
Let’s see what shells are available on your system. These are usually listed in /etc/shells.
cat /etc/shells
Sample output might look like:
/bin/sh
/bin/bash
/usr/bin/zsh
/usr/bin/fish
Step 3: Change your shell using chsh
The easiest way to change your shell is with the chsh command. Run:
chsh -s /usr/bin/zsh
Note: You need to enter the full path to the shell, and it must be one of the options listed in /etc/shells.
After you run the command, you may be prompted to enter your password.
Apply the shell change to the intended account
Step 4: Log out and back in
To activate the new shell, log out of your session and log back in. Then run:
echo $SHELL
You should now see your new shell:
/usr/bin/zsh
Optional: Test the shell
You can also test the shell before switching permanently by running it directly:
/usr/bin/zsh
Once inside, type exit to return to your original shell.
Admin Tip: Change shell for another user (root only)
If you're a system administrator and want to change the shell for another user, use:
chsh -s /bin/bash username
Bonus: Install a new shell
If the shell you want isn’t installed, you can add it using:
sudo apt install zsh # On Debian/Ubuntu
sudo dnf install zsh # On Fedora/RHEL
brew install zsh # On macOS with Homebrew
Set a valid login shell and verify the change
- Check your current shell with
echo $SHELL - List available shells from
/etc/shells - Change the shell using
chsh -s - Log out and back in to apply changes
And that’s it! You’ve successfully learned how to configure your login shell in Linux. Happy customizing!
Try it, then check the worked answer
Your task: Should the selected shell path be checked on the target system?
Use the disposable VM and the existing assistant account. Confirm /bin/bash is installed and inspect the system's permitted-shell configuration where applicable. Keep another administrative recovery session available rather than experimenting on your only working login.
Bash · complete example for this question
sudo usermod -s /bin/bash school-assistant
getent passwd school-assistantExpected behavior; machine-dependent details
The final account field contains the selected shell path.Worked answer
Yes; installed shells and policy vary.
Check the selected executable path on the target system. Neither the username nor usermod causes that shell to be installed automatically. A syntactically plausible path can still point to a missing or unsuitable program.
Check your decision
A configured shell path must be usable
Treat the shell field as a path to a program with startup behavior, not merely an account description. Verify installation, policy and the updated record. Keep interactive users and service accounts distinct when deciding what program should handle their login attempts.
Reaching the recap and completing the quizzes are separate milestones.