I am working on a Redhat server and one of the users' names appears as "bash-3.0" on the "SSH Secure Shell Client."

His name is appearing correct under /etc/passwd. How could this happen?
How can I fix this?

  • 1
    To be clear, it's not the user's name that's appearing as "bash-3.0". bash's default prompt ($PS1) appears to be '\s-\v\$ ', where \s expands to the name of the shell and \v expands to the version. \u expands to the username. See the documentation. – Keith Thompson Oct 11 '12 at 19:07

Is the user's default shell different than the others? (also in /etc/passwd) This could be the potential cause.

You get a "bash" prompt when launching bash in your terminal without configuring a custom prompt. Since it's just happening to one user, they might have a different login shell than the others or they may be launching bash in a login script or at the terminal.

If the default shell is fine (matching other users) then try determining if the .bashrc or .bash_profile is different than what's in the home folder of other users? ( Could also be ~/.profile, ~/.zprofile or ~/.login depending on what you use ... )

  • .bashrc and .bash_profile do not appear in his home directory. – WAEL Oct 11 '12 at 6:40
  • Is this different than other users? – Niall Byrne Oct 11 '12 at 6:49
  • it was solved after restoring the files from /etc/skel/, it seems that they were deleted by mistake – WAEL Oct 11 '12 at 7:05

it was solved after restoring the files (.bashrc and .bash_profile) from /etc/skel/, it seems that they were deleted by mistake


The reason why you saw bash version instead of the username after the profile files were deleted was that the command prompt (often containing the username) is set in these files. You would see exactly the same after calling bash --norc.

Interestingly, no command prompt is set in your /etc/profile, which is often the case on modern systems; usually, you have something like

if [ "$PS1" ]; then
  if [ "$BASH" ]; then
    PS1='\u@\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
        . /etc/bash.bashrc
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
      PS1='$ '

Your Answer

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

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