I noticed after I mounted my /home folder in CentOS 6.2 (post-install), that all I was getting was the bash 4.1 prompt. So, I checked out ~/. and there was no .bashrc or .bash_profile, so I created them via here. After I did, there were "anomalies", such as no prompt at all for plain su, yet a prompt for su -. Also when using just plain su, there was a /home/dedanna/bin: path added when I would echo $PATH, but not when I'd su - (note the difference; the dash). I can no longer log into root now, at all, not with terminal, not with anything, and after a reboot, I'm back to the bash 4.1 prompt, because I reset the files in ~/, thinking they're screwed.
I tried various fixes in the files, they wouldn't fly no matter what I did. Can someone please check these out and see what I have to do for these? Maybe the paths are wrong? Here's what I had in each:
In my /home, I edited them to this:
Code: Select all
# .bashrc
# User specific aliases and functions
# Source global definitions
#if [ -f /etc/bashrc ]; then
# . /etc/bashrc
#fi
bash_prompt_cmd() {
RTN=$?
smiley() {
if [ $1 == 0 ] ; then
echo ":)"
else
echo ":)"
fi
}
smileyc() {
if [ $1 == 0 ] ; then
echo $GREEN
else
echo $RED
fi
}
if [ $(tput colors) -gt 0 ] ; then
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
RST=$(tput op)
fi
smiley=$(smiley $RTN)
smileyc=$(smileyc $RTN)
local CY="\[\e[1;31m\]" # Each is 12 chars long
local BL="\[\e[1;34m\]"
local WH="\[\e[1;37m\]"
local BR="\[\e[0;33m\]"
local RE="\[\e[1;31m\]"
local PROMPT="${CY}$"
[ $UID -eq "0" ] && PROMPT="${RE}#"
# Add the first part of the prompt: username,host, and time
local PROMPT_PWD=""
local PS1_T1="$BL.:[ $CY`whoami`@`hostname` $BL: $CY\t $BL:$CY "
local ps_len=$(( ${#PS1_T1} - 12 * 6 + 6 + 4 )) #Len adjust for colors, time and var
local PS1_T2=" $BL]:.\n\[\$smileyc\]\$smiley\[$RST\] "
local startpos=""
PROMPT_PWD="${PWD/#$HOME/~}"
local overflow_prefix="..."
local pwdlen=${#PROMPT_PWD}
local maxpwdlen=$(( COLUMNS - ps_len ))
# Sometimes COLUMNS isn't initiliased, if it isn't, fall back on 80
[ $maxpwdlen -lt 0 ] && maxpwdlen=$(( 80 - ps_len ))
if [ $pwdlen -gt $maxpwdlen ] ; then
startpos=$(( $pwdlen - maxpwdlen + ${#overflow_prefix} ))
PROMPT_PWD="${overflow_prefix}${PROMPT_PWD:$startpos:$maxpwdlen}"
fi
export PS1="${PS1_T1}${PROMPT_PWD}${PS1_T2}"
smiley=$(smiley $RTN)
smileyc=$(smileyc $RTN)
local CY="\[\e[1;31m\]" # Each is 12 chars long
local BL="\[\e[1;34m\]"
local WH="\[\e[1;37m\]"
local BR="\[\e[0;33m\]"
local RE="\[\e[1;31m\]"
local PROMPT="${CY}$"
[ $UID -eq "0" ] && PROMPT="${RE}#"
# Add the first part of the prompt: username,host, and time
local PROMPT_PWD=""
local PS1_T1="$BL.:[ $CY`whoami`@`hostname` $BL: $CY\t $BL:$CY "
local ps_len=$(( ${#PS1_T1} - 12 * 6 + 6 + 4 ))
#Len adjust for colors, time and var
local PS1_T2=" $BL]:.\n\[\$smileyc\]\$smiley\[$RST\] "
local startpos=""
PROMPT_PWD="${PWD/#$HOME/~}"
local overflow_prefix="..."
local pwdlen=${#PROMPT_PWD}
local maxpwdlen=$(( COLUMNS - ps_len ))
# Sometimes COLUMNS isn't initiliased, if it isn't, fall back on 80
[ $maxpwdlen -lt 0 ] && maxpwdlen=$(( 80 - ps_len ))
if [ $pwdlen -gt $maxpwdlen ] ; then
startpos=$(( $pwdlen - maxpwdlen + ${#overflow_prefix} ))
PROMPT_PWD="${overflow_prefix}${PROMPT_PWD:$startpos:$maxpwdlen}"
fi
export PS1="${PS1_T1}${PROMPT_PWD}${PS1_T2}"
}
PROMPT_COMMAND=bash_prompt_cmd
Code: Select all
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:.
BASH_ENV=$HOME/.bashrc
USERNAME="dedanna"
export USERNAME BASH_ENV PATH
I did the same for root's, except changed the username line to dedanna for my /home, left it as root for root's. This is all very strange to me. I've edited both before, with no problem.
Here's a kicker for you, not sure if it has anything to do with it. I had to, post-install, chown my /home folder to me, because of this error. I don't know if that has anything to do with this, but with it being a permissions thing, I'm figuring it might have. I used:
Code: Select all
chown -R dedanna:dedanna /home/dedanna
Not being able to get into root right now from terminal or anywhere else at all is ending up to be a royal pain - I can't install anything, I can't do anything I need to. This also puts me in a vicious cycle wherein I can't reset those two files in root. When I try logging into root, it hangs for a minute or two, then goes right back to regular user. This is from Ctl+Alt+F2, from terminal in the desktop, and when I try logging in directly from gdm.
Thanks.