How to change the shell for an already existing user – Unix/Linux

We can change the shell of a user by using the ‘usermod’ command. Some common types of shells are listed below:
> /bin/bash
> /bin/ksh
> /bin/csh
> /bin/sh
> /sbin/nologin

We can find out the shell details from the ‘passwd’ file under ‘/etc’ location.

Display shell details of the user ‘me’

[[email protected] ~]# grep -w me /etc/passwd

Shell is : /bin/bash

How to change the shell via command line?
The usermod command with switch ‘s’ is used to change the current shell of a user. Other useful usermod switches.


[[email protected] ~]# usermod -s /sbin/nologin me
[[email protected] ~]# grep -w me /etc/passwd

The shell changed to “/sbin/nologin

That’s it!! 🙂

Related Links:
groupdel, groupmems, groupmod, useradd , usermod

Post navigation

Arunlal Ashok

Operations Engineer at Endurance International Group. Linux lover. Like to play on Linux console. I started this blog to share and discuss Linux thoughts.

Always happy for an open discussion! Write to arun (@) crybit (dot) com. Check about me for more details. About this blog and our strong members, check The team
We like to travel. Our travelogues are published at Trip Mentor

2 thoughts on “How to change the shell for an already existing user – Unix/Linux

Leave a Reply

Your email address will not be published. Required fields are marked *