Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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.

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

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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