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

Arunlal Ashok

Linux Server Administrator. I'm dealing with Linux servers since 2012. I started this blog to share and discuss my ideas with the world. Check My Profile!! in uPwork (oDesk) and let me know if you need any assistance. Thanks!!

You may also like...

2 Responses

  1. February 7, 2014

    […] Related Post: How to change the shell for an already existing user […]

  2. February 7, 2014

    […] the login shell of a user by changing the shell value in /etc/passwd file by using the command USERMOD. Shell is a program that takes your commands from the keyboard and gives them to the operating […]

Leave a Reply

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