Monday, August 19, 2013

To change the shell of the user as a user




To change the shell of the user, user  can run the “chsh” command on Linux box.
This command will change the shell of the logged in user permanently and edit the entry to the file /etc/passwd.

However, to changes come into effect – logout of the logged in user is necessary.

Please find the below pasted screen shot for your quick understanding.

$ chsh –s /bin/bash
  To change permanently to a different shell.



Note: Kindly note, that Root intervention is NOT required here.



 Output:
[che@redhat5vm1 ~]$ uname -a
Linux redhat5vm1 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux

[che@redhat5vm1 ~]$ who am i
che      pts/3        2013-08-19 11:13 (localhost.localdomain)
[che@redhat5vm1 ~]$ echo $SHELL
/bin/bash

[che@redhat5vm1 ~]$ grep che /etc/passwd
che:x:502:502::/home/che:/bin/bash

[che@redhat5vm1 ~]$ finger -m che
Login: che                              Name: (null)
Directory: /home/che                    Shell: /bin/bash
On since Mon Aug 19 11:13 (PDT) on pts/3 from localhost.localdomain
No mail.
No Plan.


[che@redhat5vm1 ~]$ chsh -s /bin/ksh
Changing shell for che.
Password:
Shell changed.

[che@redhat5vm1 ~]$ exit
logout
Connection to localhost closed.

After logout and login again.

sh-3.1# ssh che@localhost
che@localhost's password:
Last login: Mon Aug 19 11:13:36 2013 from localhost.localdomain


$ echo $SHELL
/bin/ksh
$ grep che /etc/passwd
che:x:502:502::/home/che:/bin/ksh
$ finger -m che
Login: che                              Name: (null)
Directory: /home/che                    Shell: /bin/ksh
On since Mon Aug 19 11:16 (PDT) on pts/3 from localhost.localdomain
No mail.
No Plan.
$

1 comment:

  1. Dear Sir please guide me regarding the scope of Solaris and Linux which is the best field as an administrator point of view.

    ReplyDelete