• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • How to change default login shell permanently in linux

    In Red hat Linux the default shell you login to is /bin/bash but in case you want to change the default login shell follow the below procedure

    To check the currently logged in shell
    # echo $SHELL

    To view all the available shells in your machine
    # chsh -l

    You can also view the available shell details from the below file
    # less /etc/shells

    To change the shell temporarily

    To do this just provide the full path of the shell you want to use. But this is just a temporary change as next time you switch terminal you will login to the default shell

    [root@test2 ~]# /bin/sh
    As you see above my shell prompt changed from /bin/bash to /bin/sh

    To change the shell prompt permanently

    # chsh -s /bin/sh
    Changing shell for root.
    Shell changed.

    [root@test2 ~]#
    But as you notice even though our shell was changed successfully but still we see bash shell prompt.

    NOTE: To make the changes affect you need to log out and log back in
    Using username "root".
    root@'s password:
    Last login: Fri Mar 21 10:15:03 2014 from
    -sh-4.1# echo $SHELL

    So now as I try to login I see my default login shell is changed to /bin/sh

    Which file is responsible for assigning shell by default?

    What if you want next time you create a user, he/she should get different shell and every time you don't change their shell manually

    Check the below file
    # cat /etc/default/useradd
    # useradd defaults file

    As you see the SHELL argument has /bin/bash as default. Just change this value to any shell you want to provide for a new user.

    Related Articles
    How to change user Password Expiry, Home Directory etc in Linux
    How to create user without useradd command in Linux
    How to give normal user root privileges using sudo in Linux/Unix

    Follow the below links for more tutorials

    Configure Red Hat Cluster using VMware, Quorum Disk, GFS2, Openfiler
    Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
    How to configure Samba 4 Secondary Domain Controller
    How to secure Apache web server in Linux using password (.htaccess)
    How to register Red Hat Linux with RHN (Red Hat Network )
    Red hat Enterprise Linux 5.5 Installation Guide (Screenshots)
    15 tips to enhance security of your Linux machine
    Why is Linux more secure than windows and any other OS
    What is the difference between "su" and "su -" in Linux?
    What is kernel-PAE in Linux?
    What is swappiness and how do we change its value?
    How to log iptables messages in different log file
    What are the s and k scripts in the etc rcx.d directories
    How to check all the currently running services in Linux
    How to auto start service after reboot in Linux
    What is virtual memory, paging and swap space?

    Deepak Prasad

    is a techie and an author who is still trying to survive in this IT generation with very little knowledge he has on Linux/Unix, VMware, SAN Storage, Automation, networking etc

    You can follow him on Facebook or Google+

    Do you also have something to share here?

    Become an author and be a part of our GoLinuxHub Team, Click here for more information
    How to change default login shell permanently in linux How to change default login shell permanently in linux Reviewed by Deepak Prasad on Sunday, March 23, 2014 Rating: 5

    1 comment:

    Powered by Blogger.