19

I just created a new user on my system using useradd -d /home/users/john -m john (Using Ubuntu 11.04). This worked fine, but when I changed to john, my bash is not fully functional. That is, it has no autocomplete, I can not use they arrow keys (e.g. UP to get the last command), and instead of showing my current directory it only shows $. I loaded a .bashrc but this appears to be completely ignored. What could cause this?

PD: this user is already working on the system and I rather not remove it and add it again, if possible.

  • Define what you mean by "when I changed to john". Did you log in with that user at the main console, on a pty, through ssh, or did you su or su -? – Paul Tomblin Nov 27 '11 at 19:36
  • What are the permissions/ownership on the .bashrc you loaded? – Paul Tomblin Nov 27 '11 at 19:37
34

Probably john's shell is not /bin/bash, but /bin/sh. On Ubuntu, that's a shell intended to execute scripts fast, with no fancy interactive features such as command line edition. Check last column of grep john /etc/passwd or getent passwd john. You might want to run chsh -s /bin/bash john to change user's shell.

  • 1
    Excellent, that was indeed the case! – user11780 Nov 27 '11 at 20:03
  • 2
    Just a note. In Ubuntu /bin/sh is symbolic link to dash i.e. /bin/dash, so ultimately user's shell is /bin/dash. – Sachin Divekar Nov 27 '11 at 20:52
5

you can jump between shells by typing the name of the shell

$ bash

and in the next line you will get this following prompt

user@hostname$ 

which is the bash shell. Your up arrow key and autocomplete will work now

  • It should be noted that is obviously temporary. The currently accepted answer has a more permanent solution. – jw013 Nov 7 '12 at 14:30
  • ok I didnt know that, thanks for that I will save the accepted answer for future reference – Saad Nov 8 '12 at 6:28

Your Answer

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