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
- $ vi /etc/passwd
- foo:x:1001:1001::/home/foo:/bin/sh
- foo:x:1001:1001::/home/foo:/bin/bash
e) Logout and login back
2. Use chsh command
a) type chsh
- $ chsh
c) This screen will appear
- Enter the new value, or press ENTER for the default
Login Shell [/bin/sh]:
Done :)
18 comments:
You should use vipw instead of just vi the passwd file.
how about using the options from useradd command
# 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.
# 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.
Thank you!!! Thank you!!
Thanks all. Solution by Mitch Sheean didnt work (tried as root, not error msg, but didnt work).
Had 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?
I 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.
You 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.
On the question of permanently changing the shell using useradd on Ubuntu, it requires:
useradd -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:
useradd -Ds /bin/bash
using
useradd -D -s /bin/bash
will set the SHELL default to an empty string.
root@ccc:~#
root@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.
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.
Thanks you. Its very useful and is
written in simplest way.
Thanks, its very useful and is written in simplest way.
Brilliant!
Brilliant!
Post a Comment