Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello everybody!
since yesterday I got a puzzle with new sessions of bash (I noticed first in Konsole but the same happens when I go to tty6 and I log in there).
When the session begins I get a lot of garbage like...
Check the .bashrc file in your home directory. It looks like it got corrupted somehow.
Thanks, Crashed_Again for the suggestion, but there is no ".bashrc" in my box; perhaps I had to tell that before: I'm under salckware, if I'm not wrong slack doesn't come with such file by default. Anyway I think that the relevant file is "/etc/profile" or any in "/etc/profile.d/", but I don't know which one is, what to do with it and, of course, why did it get corrupted.
BTW, this is the content of "/etc/profile.d/" (just in case...)
Here is my "/etc/profile" (there is no "/etc/bashrc")
Code:
# /etc/profile: This file contains system-wide defaults used by
# all Bourne (and related) shells.
# Set the values for some environment variables:
export MINICOM="-c on"
export MANPATH=/usr/local/man:/usr/man:/usr/X11R6/man
export HOSTNAME="`cat /etc/HOSTNAME`"
export LESSOPEN="|lesspipe.sh %s"
export LESS="-M"
# If the user doesn't have a .inputrc, use the one in /etc.
if [ ! -r "$HOME/.inputrc" ]; then
export INPUTRC=/etc/inputrc
fi
# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games"
# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH. Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
fi
fi
# I had problems using 'eval tset' instead of 'TERM=', but you might want to
# try it anyway. I think with the right /etc/termcap it would work great.
# eval `tset -sQ "$TERM"`
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
TERM=linux
fi
# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
VISUAL=emacs
# VISUAL=gmacs
# VISUAL=vi
fi
# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
if [ "$SHELL" = "/bin/pdksh" ]; then
PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
PS1='! ${PWD/#$HOME/~}$ '
elif [ "$SHELL" = "/bin/zsh" ]; then
PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
PS1='$ '
else
PS1='\u@\h:\w\$ '
fi
PS2='> '
export PATH DISPLAY LESS TERM PS1 PS2
# Default umask. A umask of 022 prevents new files from being created group
# and world writable.
umask 022
# Set up the LS_COLORS and LS_OPTIONS environment variables for color ls:
if [ "$SHELL" = "/bin/zsh" ]; then
eval `dircolors -z`
elif [ "$SHELL" = "/bin/ash" ]; then
eval `dircolors -s`
else
eval `dircolors -b`
fi
# Notify user of incoming mail. This can be overridden in the user's
# local startup file (~/.bash.login or whatever, depending on the shell)
if [ -x /usr/bin/biff ]; then
biff y
fi
# Append any additional sh scripts found in /etc/profile.d/:
for file in /etc/profile.d/*.sh ; do
if [ -x $file ]; then
. $file
fi
done
# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
PATH="$PATH:."
fi
However I do believe that the problem is the command "dircolors"; I have tried "dircolors -b" and got the same garbage as I told before.
One (very) interesting point is that the file "/etc/DIR_COLORS" (where configuration of "dir_colors" lives) was changed monday (just the day the strange behaviour began):
it is pretty big, should it be so big?
How can I edit it? It looks coded, but it must be plain text, according to its manpage (man 5 dir_colors), mustn't it?
I would say that for some reason the "/etc/DIR_COLORS" was overwritten, but to be honest I didn't realized of the presence of such file until now, so I'm not sure about this.
Moreover, I noticed that every file in "/etc/profile.d/" is executed and changes take effect, but the environment variable PATH doesn't change at all. I bet this is related to this other issue, but how?
Looks like the file is corrupted. Mine is < 3k and is plain text. I would suggest replacing it. The better question is why the file was changed...you say you didn't do it yourself? Was someone messing with your box?
If you can't get an uncorrupted DIR_COLORS then I spose I could post mine here...
Thanks bulliver!
That's what I did, I replaced the corrupted "/etc/DIR_COLORS" with a good one; I got one from the last backup I did (fortunately I use to back up the "/etc" directory as well )
As I told before, I didn't even touch the "/etc/DIR_COLORS", and I'm quite sure that nobody else did it (unless a thief came into my home and instead of robbing something he decided to corrupt my /etc/DIR_COLORS file )
As soon as I put a good DIR_COLORS file into my system and I restarted bash, everything worked again like a charm, so the key point now is, how could this file get corrupted?
From my paranoiac side I'd say that some cracker did it "for me"; but after taking a quick look to the rest of the system I didn't noticed any remarkable event, so I don't understand why should someone be so stealthy entering and afterwards be so noisy, but who knows...
Any sensible explanation? I feel now a bit insecure
I don't know what to tell you, going from a plain text file to 4.9MB of garbage is a little suspect. Is anything else amiss? I don't want to alarm you but if not a cracker, I don't know how else your file could get corrupted like that.
I would recommend going very closely over your logs and look for any sort of login that you know you did not do....
Did you keep a copy of the corrupted file?? Might be interesting to look at with a hex editor.
Hi!
well, I was looking again at the logs. Last post I didn't mention one curious thing I noticed, but may be important: the /var/log/syslog* set of files have gaps jumping some days, even one file is totally empty. I use to keep the computer on continuosly, and perhaps that could be the reason why there are gaps in my syslogs. However I didn't realize those gaps before.
Appart from this nothing special is in my logs (that seems to me), but I'll keep an eye on them...
BTW, I of course keep the corrupted file, I edited with KHexEdit and I cannot see anything remarkable in it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.