Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am attempting to use a simple shell script on a base Ubuntu 12.04 server install to set prompt colors for users system wide.

I would like to have Puppet place the file in /etc/profile.d/ -- with permission 744

but the file isn't being sourced by users at all. ~/.bashrc appears to override this.

    if [[ ${EUID} == 0 ]] ; then
        PS1="\\[\\033[01;31m\\]\\h\\[\\033[01;34m\\] \\W \\$\\[\\033[00m\\] "
        PS1="\\[\\033[01;32m\\]\\u@\\h\\[\\033[01;34m\\] \\w \\$\\[\\033[00m\\] "

I would prefer not to manipulate ~/.bashrc files with Puppet, but instead have this work globally with profile.d script.

share|improve this question
up vote 2 down vote accepted

The default Ubuntu ~/.bashrc will overwrite any earlier values of PS1 which is what you're seeing. You could make PS1 read only

declare -r PS1=...

but this will cause the default ~/.bashrc to emit

-bash: PS1: readonly variable

which may not be desirable. You can edit /etc/skel/.bashrc to remove the lines that set PS1 so that new users will not get init scripts that by default try and overwrite your global PS1 definition. That won't stop them from adding their own PS1 definitions but the error message above would clue them in.

share|improve this answer
Thank you! I ended up using /etc/skel/.bashrc and put the prompt colors for user and root in there. Works great now. – sepulworld Mar 20 '13 at 4:21

Your Answer


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.