Change Linux Default Shell
It is a simple process to change any user's default shell to any available shell which is install on the Linux system.
Become the root super user:
$ su - root
OR if you are set up with sudo:
$ sudo su - root
Your command prompt should now have a # in it instead of a $, indicating you are now the root super user, as shown here:
(Note: root@localhost may be displayed as root@your_machinename in the following examples and your display prompt might be slightly different - just ensure it contains the #)
[root@localhost ~]#
Edit the passwd file in the /etc directory:
[root@localhost ~]#vi /etc/passwd
Search for the username you are wanting to change shells for using the slash("/") vi search function:
With the passwd file open in the vi text editor, tap the "/" key which brings up the "/" in the bottom left corner of the vi editor, waiting for you to type your search word. Type the name of the user login name and hit the ENTER key to find the entry. Then, using the right cursor movement arrow key, move your cursor all the way to the end of the line, to the very first letter of the name of the shell the user is currently set up to use. For example, say I want to change jamie's default shell from sh to bash, as root, I'd open /etc/passwd in vi and search for jamie:
root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin . . . jamie:x:1000:1000:Jamie Rubinstein:/home/jamie:/bin/sh
Use the right cursor arrow key to move to the letter "s" for the current shell, /bin/sh, and tape the c key and then w key one after the other fairly quickly,which will put you in "Change Word" and "Insert" mode, stating so in the bottom left corner of your screen, and deleting the "sh" part of "/bin/sh" and allowing you to type in text:
jamie:x:1000:1000:Jamie Rubinstein:/home/jamie:/bin/ . . . ~ ~ ~ -- INSERT --
Type in "bash", without the quotes, and then hit the "Esc" key once. The "-- INSERT --" at the bottom left corner of your screen will be gone, indicating you are no longer in "INSERT" mode, but instead in the other VI mode, command mode. The updated line should now look like this:
jamie:x:1000:1000:Jamie Rubinstein:/home/jamie:/bin/bash
To save the file and exit the vi editor, while in command mode(no longer have "-- INSERT --" at bottom left corner of vi screen), tap the colon(":") key once, which will apear at the bottom left corner of your screen,and then tap the x key(lower case), which will apear aftre the colon,like this:
:jamie:x:1000:1000:Jamie Rubinstein:/home/jamie:/bin/bash . . . ~ ~ ~
Hit the "ENTER" key at this point to save and exit. The effect takes effect the next time the user logs into the system.
http://www.dawgland.com/wiki/ Return to main Wiki page
http://www.dawgland.com Go to main Dawgland.com/J.R. Computers Page!