[CentOS] Setting PS1 for ordinary users

Tony Molloy tony.molloy at ul.ie
Thu Oct 11 02:44:28 EDT 2012


On Wednesday 10 October 2012 19:42:32 James B. Byrne wrote:
> CentOS-6
> 
> When I login as root I see this prompt:
> 
> 
> [root at vhost04 ~]#
> 
> When I login as a non-priviledged user I see this instead:
> 
> sh-4.1$
> 
> .bashrc and .bash_profile have identical contents in /root and
> /home/user.  What causes the difference?  Why?  How does one change
> the default so that all normal users get a [userid at hostname pwd]$
> prompt?
>
> I have loked in/etc/profile.d and /etc/bashrc and I cannot see what
> condition is triggering the different behaviour.
> 

Create a file called  /etc/sysconfig/bash-prompt-xterm

with contents

#!/bin/bash
echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD} [ `tty | sed -e 
"s:/dev/::"` ]\007"

watch for line wrap in e-mail

You can edit to suit your taste but the above gives

[molloyt at mufc ~]$ 

Then make sure your users have bash as their shell in the password file 
not sh.

Regards,

Tony







More information about the CentOS mailing list