Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When logging in as root at my server everything works fine, but when I log in as myusername the bash is not working correctly.

The line starts with:

$ 

instead of

myusername@myserver:~$

and all specials keys like the arrow keys, tab keys, etc. won't work.

When I type bin/bash it works again, but I'd like to fix the problem or auto run bin/bash on login. How can I fix this?

share|improve this question

migrated from serverfault.com Oct 8 '12 at 18:49

This question came from our site for system and network administrators.

3 Answers 3

up vote 5 down vote accepted

You just need to change your shell. As that user, run:

$ chsh - s /bin/bash

Then sign out and back in.

After doing this the prompt doesn't look like you want, you'll need to start tweaking your environment's PS1 variable.

share|improve this answer
    
that did it, thanks! –  askmike Sep 7 '12 at 12:06
    
This is actually kind of dangerous since the question is asking about the root user. He's likely not using Linux. Root should stay with the default shell since the vendor is probably going to count on it being ksh or whatever else they chose. Instead, the real answer is "you shouldn't be logging in as root anyway". –  bahamat Oct 8 '12 at 22:22

You need to change your shell. Run the command

chsh -s /bin/bash

then sign in again.

However, not all users have the right to change their own shell. If you use sudo remember to add your username to the chsh command as

sudo chsh <username> -s /bin/bash

otherwise you will change the shell for root inadvertently.

share|improve this answer
    
Fair point. Extended the answer slightly. –  Mikael Fremling May 13 at 13:00

One possible reason is that the default shell of myusername is not bash.

You can check the shell of your current user with:

  • echo ${SHELL}
  • echo $0

To change the user shell permanently see man chsh , e.g.:

chsh -s /bin/bash
share|improve this answer

Your Answer

 
discard

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