23

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.

2
  • 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 -? Nov 27, 2011 at 19:36
  • What are the permissions/ownership on the .bashrc you loaded? Nov 27, 2011 at 19:37

2 Answers 2

47

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.

3
  • 1
    Excellent, that was indeed the case!
    – user11780
    Nov 27, 2011 at 20:03
  • 3
    Just a note. In Ubuntu /bin/sh is symbolic link to dash i.e. /bin/dash, so ultimately user's shell is /bin/dash. Nov 27, 2011 at 20:52
  • I had to log out of all the users' sessions as well.
    – Sydwell
    Feb 11, 2021 at 5:53
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

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

Your Answer

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