This is very similar to all the other questions out there but at the same time not.

I am running Ubuntu 12.04.4 LTS (GNU/Linux 3.2.0-59-generic x86_64) to be precise.

I successfully setup a new user with: useradd -m webuser, however, no matter what I do I cannot seem to get most the bash functions like auto complete and history to work.

For example my bashrc file has:

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)

but when I echo "$HISTFILESIZE" I do not get null but I do not get a result either:


(Unfortunately this site doesn't allow me to actually show you since it tries to be very intelligent).

This goes for all history variables.

No matter what I do I cannot seem to get the basic environment variables to work and, as it seems the .bashrc to be read.

Ontop of this my set -o is pathetically small:

Current option settings
errexit         off
noglob          off
ignoreeof       off
interactive     on
monitor         on
noexec          off
stdin           on
xtrace          off
verbose         off
vi              off
emacs           off
noclobber       off
allexport       off
notify          off
nounset         off
nolog           off
debug           off

and all the question I try don't help, i.e.: https://superuser.com/questions/174306/how-can-i-enable-the-bash-command-history

I am logging in using SSH via PuTTY.


Output of echo $0 straight from the ssh temrinal:

$ echo $0
  • Are you definite you are using bash? What is the output of echo $0? – Sparhawk Mar 11 '14 at 10:09
  • @Sparhawk the output is -sh, I assume I am using bash because I am using the same terminal and login method as I do for root whose profile works fine – Sammaye Mar 11 '14 at 10:11
  • Are you sure that it's -sh and not sh? – Sparhawk Mar 11 '14 at 10:12
  • @Sparhawk added it fully to the question – Sammaye Mar 11 '14 at 10:13
  • Sounds like if PuTTY would not start a proper login shell maybe it just starts a ssh Connection to the PC and then lauches bash as if you would just run the command bash inside of a already existing Shell on the Local Machine. It may help to do a source .bashrc – konqui Mar 11 '14 at 10:15

I'm not 100% sure what -sh is, but you might be using sh, not bash. From memory, new users default to sh. To make them automatically use bash, modify /etc/passwd with root permission. e.g. one of

sudo vim /etc/passwd
sudo nano /etc/passwd
gksu gedit /etc/passwd

Then, find the line with your username in it. Change the final part from (e.g.) /bin/sh to /bin/bash. Restart the terminal or log in/out again.

| improve this answer | |
  • Yep that was it exactly thanks! Never knew that – Sammaye Mar 11 '14 at 10:20
  • No worries. I've struggled through exactly the same problems, and it certainly wasn't obvious to me at the time! – Sparhawk Mar 11 '14 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.