This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Thursday, April 12, 2018

How to change the default login shell by command line in linux server?

By using chsh command we can change the default login shell to other shell.

By using -l option we can list the available login shell on linux server.

[root@testserver ~]# chsh -l
/bin/sh
/bin/bash
/sbin/nologin
/bin/dash
/bin/tcsh
/bin/csh
/bin/ksh

Then which user login shell need to change, we can change by below command. (If a shell is not given on the command line, chsh prompts for one)

[root@testserver ~]# chsh hygmtng7
Changing shell for hygmtng7.
New shell [/bin/ksh]: /bin/bash
Shell changed.

Before
[root@testserver ~]# cat /etc/passwd | grep -i hygmtng7
hygmtng7:x:20009:20009::/gmtng7/hyperion:/bin/ksh

After
[root@testserver ~]# cat /etc/passwd | grep -i hygmtng7
hygmtng7:x:20009:20009::/gmtng7/hyperion:/bin/bash

No comments:

Post a Comment