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.

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?

share|improve this question
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
add comment

3 Answers 3

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 ... )

share|improve this answer
    
.bashrc and .bash_profile do not appear in his home directory. –  bob 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 –  bob Oct 11 '12 at 7:05
add comment

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

share|improve this answer
add comment

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
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi
share|improve this answer
add comment

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.