Change Linux user shell

To change shell for a user, run

chsh --shell PATH_TO_SHELL USERNAME

Example

chsh --shell /bin/bash okadmin

I will add a user, if no shell specified, it use sh as shell.

root@lab:~# useradd okadmin
root@lab:~# su - okadmin
No directory, logging in with HOME=/
$ echo $SHELL
/bin/sh
$ exit
root@lab:~# chsh --shell /bin/bash okadmin
root@lab:~# su - okadmin
No directory, logging in with HOME=/
okadmin@lab:/$ echo $SHELL
/bin/bash
okadmin@lab:/$ logout
root@lab:~# 

You can find what shell you are using now with command

echo $SHELL

Comments

Leave a Reply

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