FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 10-11-2012, 06:44 AM
Tony Molloy
 
Default Setting PS1 for ordinary users

On Wednesday 10 October 2012 19:42:32 James B. Byrne wrote:
> CentOS-6
>
> When I login as root I see this prompt:
>
>
> [root@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@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 "33]0;${USER}@${HOSTNAME%%.*}:${PWD} [ `tty | sed -e
"s:/dev/::"` ]07"

watch for line wrap in e-mail

You can edit to suit your taste but the above gives

[molloyt@mufc ~]$

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

Regards,

Tony





_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-11-2012, 12:20 PM
"Mike Burger"
 
Default Setting PS1 for ordinary users

--
Mike Burger
http://www.bubbanfriends.org

"It's always suicide-mission this, save-the-planet that. No one ever just
stops by to say 'hi' anymore." --Colonel Jack O'Neill, SG1


> On Wed, Oct 10, 2012 at 03:48:23PM -0400, James B. Byrne wrote:
>> To clarify the situation. The ONLY difference in the shell setup for
>> both root and an ordinary user is the name. As shown below they bith
>> use the same shell, they both have exactly the same contents in
>> .bashrc and .bash_profile. The file .profile exists for neither. And
>> yet somehow they end up with totally different PS1 values.
>>
>> How this happens I wish to discover. Where is root getting its PS1
>> value set and why is root's prompt surrounded by []? The ordinary
>> user's PS1 value is that of the bash default which indicates to me
>> that it is not being set anywhere.
>>
>> There is a good deal of code given over to setting the PS1 value in
>> /etc/bashrc but it seems to depend upon PS1 being already set. I can
>> find no reference to PS1 in any file in/root and the oly reference in
>> /etc/profile.d is in colorls.sh which seems to be testing PS1 for a
>> zero length string (i.e unset value).
>>
>> Where is PS1 actually being set?
>
> James,
>
> Have a look in /etc/bashrc (and scripts called from there, such
> as in /etc/profile.d).
>
> HTH,

To be more specific, look at the root user's .bashrc and the regular
user's .bashrc, and note whether or not they contain:

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

On my system(s), /etc/bashrc contains the specifics for setting $PS1. If
your system's /etc/bashrc contains the same, and the regular users'
.bashrc files are not calling /etc/bashrc, this may explain the lack of
"appropriate" prompt display.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 11:40 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org