How to automatically launch bash shell when opening terminal or in console mode?
I create a normal user account in ubuntu using "useradd" command, but the problem is that I have to type "bash" to launch the bash shell for this user account in both the console mode (in a tty, through ctrl+alt+Fn) and the remote mode (via ssh). The most important part of bash shell for me is the auto-completion function, so my question is that how I could make the bash shell launch automatically when logging into the account.
I use ubuntu 13.04 32bit version. I appreciate for any advice!
Solution 1:
You probably need to set bash as your new users's login shell. If you are logged in as that user:
chsh -s /bin/bash
To change it for another user
sudo chsh -s /bin/bash username
In future you might want to use adduser
instead of the low-level useradd
, since it defaults to setting bash as the new login shell.
You can check the login shell (among other details) by looking at the /etc/passwd file or using
getent passwd username
Solution 2:
First of all, check if useradd
shows a default value for SHELL
. To do that, issue:
useradd -D
This will output something like:
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/sh
SKEL=/etc/skel
CREATE_MAIL_SPOOL=no
These values are taken from /etc/default/useradd
. Now, you have 2 solutions:
- Edit
/etc/default/useradd
, and change the value ofSHELL
, or - Override the shell's value when adding user with:
useradd -D -s /bin/bash
For more information see man useradd
.