You are not logged in.
Pages: 1
Hello there
I'm trying to set up a simple .bashrc color prompt for "myuser" and "root" by editing /home/myuser/.bashrc and /root/.bashrc
Both are working fine in any gnome terminals, I see my nice new colors, and if i use sudo su, i see roots color prompt
However, if I switch to any of my tty1-6 and I log in as root or myuser, I still see the old white bash colors
It looks like /etc/bash.bashrc is relevant here, but how ?
(Strangest thing, if I log in into tty1-6 with myuser, colors are white - but if I do sudo su, I have the colors of /root/.bashrc)
How can I have simply my colors in a terminal login without touching my /etc/bash.bashrc?
“The future has already arrived. It's just not evenly distributed yet.”
― William Gibson
Offline
Is bash your login shell? Try to source /home/myuser/.bashrc by hand:
. /home/myuser/.bashrcOffline
what do you mean by sourcing it? ( and yes, it is my shell)
# cat /etc/passwd | grep myuser:
myuser:x:1000:100:BloodyMe,,,:/home/myuser:/bin/bash
Last edited by scar (2010-10-02 22:04:29)
“The future has already arrived. It's just not evenly distributed yet.”
― William Gibson
Offline
what do you mean by sourcing it?
Run the command I posted: 'dot space /path/to/your/.bashrc'
Offline
The difference between your TTYs and your gnome terminals is that a TTY is a login shell and the gnome terminals are non-login shells.
Login shells read the profile files (/etc/profile, ~/.bash_profile, ~/.bash_login, and ~/.profile) and non-login shells read the bashrc (/etc/bash.bashrc and ~/.bashrc).
The most easy way to force your TTY to do the same as your gnome terminal is to source the .bashrc in .profile.
Offline
it is done, buit i have to do it with all my users including root?
if it is the case, when I log in as root, it works fine, but with a regular user it is a bit funny, I got an error message ( do not have perm to access /root/.bashrc - because I've "sourced it" ) ![]()
Why can't it work just with ~/.bashrc ?
Last edited by scar (2010-10-02 22:12:20)
“The future has already arrived. It's just not evenly distributed yet.”
― William Gibson
Offline
Read patlkli's post and don't source root's stuff as a user ;P
Not sure if it helps you understand but http://wiki.archlinux.org/index.php/Hel … and_source
Last edited by karol (2010-10-02 22:14:50)
Offline
not really dolved the problem, but :
I've edited my .bashrc with this stuff in it:
if [ `id -u` = 0 ] # is it root ?
then
. /root/.bashrc
fi
if [ `id -u` = 1000 ] # is it myuser ?
then
. /home/myuser/.bashrc
fi
It would be nicer if bash used my .bashrc simply in any ttys too............
“The future has already arrived. It's just not evenly distributed yet.”
― William Gibson
Offline
not really dolved the problem, but :
I've edited my .bashrc with this stuff in it:
.
Your .bashrc or bash_profile?
Offline
my .bashrc
“The future has already arrived. It's just not evenly distributed yet.”
― William Gibson
Offline
my .bashrc
In your /home/myuser/.bashrc? And it did help?
Offline
sorry, I was not precise enough
The file above is /etc/bash.bashrc
I'm sourcing the profiles of myuser and root, and it solved the problem
But if I add a new user, I have to source his profile too, else his profile remains the same even if I edit his .bashrc
So it does not solved anything, it is just a workaround
(my install is a fresh one)
“The future has already arrived. It's just not evenly distributed yet.”
― William Gibson
Offline
There's a few ways you can do this:
1) Set the PS1 in /etc/profile and do *not* set it anywhere else.
2) Set the PS1 in ~/.bash_profile and do *not* set it in ~/.bashrc
This means you'll have to set each user's one, but the user's .bash_profile gets set from a template one whenever their account is created. So set it in there, too.
I'm not sure where this template file is, but I'm sure it can be found with a search.
3) Set the PS1 in ~/.bash_profile and source that file from ~/.bash_profile. Again, see (2) for new users. The ~/.bashrc will also get created from a template.
4) Do what you're doing now, but change your code to this:
. $HOME/.bashrcThe $HOME will return the path to the user's .bashrc so you don't need to hard code in paths or check for IDs etc.
5) To be suggested by someone else ![]()
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Now it makes more sense :-)
/etc/skel/.bash_profile has the line you need: '. $HOME/.bashrc'. If you create a new user with the skel files copied over to his home folder, you have a working profile w/o any tricks.
Offline
/etc/skel/.bash_profile
That's the one. Forgot about skel (age you know). ![]()
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
/etc/skel/.bash_profile
That's the one. Forgot about skel (age you know).
;P
Those files are used when you
useradd -m-m, --create-home
Create the user's home directory if it does not exist. The files and directories contained in the
skeleton directory (which can be defined with the -k option) will be copied to the home directory.By default, no home directories are created.
If you omit the '-m' switch you need to fix it yourself.
Offline
Pages: 1