I faced this problem when I created a new account using command line where the default shell of my new account is /bin/sh. After googling around, I found 2 useful solutions which are listed below:
1. Change user entry in /etc/passwd
a) edit /etc/passwd using any editor
b) find the line that belongs to the user (foo) that we about to modify
- foo:x:1001:1001::/home/foo:/bin/sh
c) change from /bin/sh to /bin/bash
- foo:x:1001:1001::/home/foo:/bin/bash
d) save
e) Logout and login back
2. Use chsh command
a) type chsh
b) You will be asked for password. Enter your password
c) This screen will appear
- Enter the new value, or press ENTER for the default
Login Shell [/bin/sh]:
d) Put
/bin/bash at the menu and press Enter
Done :)
You should use vipw instead of just vi the passwd file.
ReplyDeletehow about using the options from useradd command
ReplyDelete# useradd foo -s /bin/bash
the user foo will be created with the /bin/bash shell allocated to him.. thanks..
You can change it permanently with the -D option.
ReplyDelete# To see current settings
# useradd -D
# To change default shell for all new accounts
# useradd -D -s /bin/bash
Cheers,
Mitch Sheean
Thanks for the post. This is just what I need now.
ReplyDeleteThank you!!! Thank you!!
ReplyDeleteThanks all. Solution by Mitch Sheean didnt work (tried as root, not error msg, but didnt work).
ReplyDeleteHad to do manually in /etc/passwd (changed all to bash :D).
cheers
JP
That's odd that the -D option didn't work for you. What distro do you run?
ReplyDeleteI use it for new Ubuntu installs. Run it once and it should set your default shell to bash. Any new users you add will show bash in the /etc/passwd file.
Check the man age too for useradd.
Also, maybe you used the # sign with the command? That should not be part of it. It's meant to denote a prompt.
ReplyDeleteYou don't need the first bit of the post at all. You can start up bash manually (by issuing `bash' at the prompt), then use `chsh' as stated.
ReplyDeleteOn the question of permanently changing the shell using useradd on Ubuntu, it requires:
ReplyDeleteuseradd -Ds /bin/bash
If you do it with -D -s, it will just change the SHELL default to an empty string.
MMurphy
In ubuntu, use:
ReplyDeleteuseradd -Ds /bin/bash
using
useradd -D -s /bin/bash
will set the SHELL default to an empty string.
root@ccc:~#
ReplyDeleteroot@ccc:~# useradd -D -s /bin/bash
root@ccc:~# useradd -D
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=no
root@:~# ^C
I've included this post on my blog as record for my self and effort to preserve accurate instructions. I have provided a link to this blog citing it as the source of the information. Thank you much.
ReplyDeleteI've included this post on my blog as record for my self and effort to preserve accurate instructions. I have provided a link to this blog citing it as the source of the information. Thank you much.
ReplyDeleteThanks you. Its very useful and is
ReplyDeletewritten in simplest way.
Thanks, its very useful and is written in simplest way.
ReplyDeleteBrilliant!
ReplyDeleteBrilliant!
ReplyDelete