1

Ubuntu Server newbie here, got some annoying issues with remote accessing my box with Putty. When I create a user and then login as that user, the terminal always starts with just '#' and not 'user@hostname:~#' which isn't useful where I want to see where I've changed directory too, like I can normally.

Also, when logged in as a user, I can't press the cursor keys to move the caret (blinking thing) around, or press up to see previously executed commands. Instead it gives me this representation of the button pressed: ^[[D ^[[A ^[[B ^[[C. Pressing Delete, too, gives me ^[[3~.

This is all strange to me, because when logged in as root, it all works fine. I'm hoping this is just something I've accidentally changed in Putty, or added the user wrongly, or perhaps just got caps lock on. Thanks.

2 Answers 2

2

When you login, try typing bash at the prompt to launch the bash shell. It sounds like you're in the wrong shell (perhaps sh), even though bash should be the default. As for setting the prompt, you'll want to look into setting the PS1 environment variable.

3
  • He may need to change the shell permanently as suggested by Dennis Williamson.
    – Khaled
    Dec 24, 2010 at 17:28
  • Bash doesn't use PROMPT, but the Z shell can. Bash uses PS1. Dec 25, 2010 at 0:58
  • You are absolutely right, Dennis. My apologies... I haven't used bash in forever. x_x
    – Andrew M.
    Dec 25, 2010 at 1:48
2

Bash should have line editing and a nice prompt set up by default. To set a more informative prompt, if it's not already, you can set the PS1 environment variable:

PS1='\u@\h:\w\$ '

To change the user's login shell to Bash:

chsh -s /bin/bash username

or set it during the creation of the user:

adduser --shell /bin/bash (other options)

or by editing /etc/adduser.conf to set the default shell.

In your question, you show # as the prompt. That usually indicates the root user. It's best if you don't run as root. Login as a normal user and use sudo to perform administrative functions.

I would advise leaving the root user's shell set to sh and on the rare occasions that it's necessary to login as root, if you want to use Bash, just start it at the command line.

3
  • On some systems, the command is called useradd not adduser :)
    – Khaled
    Dec 24, 2010 at 17:30
  • @Khaled: True, but the OP said "Ubuntu" where adduser is a front end to useradd. Dec 24, 2010 at 17:38
  • Yes, you are right. I just wanted to note that the command name may differ on other systems.
    – Khaled
    Dec 24, 2010 at 17:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .