LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-20-2012, 05:24 PM   #1
yaximik
Member
 
Registered: Nov 2010
Posts: 87

Rep: Reputation: 0
why do I see this?


Hi,

Out of nowhere, but now every time I log-in as root I get this output to stdout:

Code:
[yaximik@G5NNJN1 ~]$ su -
Password: 
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
+ '[' -f /root/.bashrc ']'
+ . /root/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
++ alias 'rm=rm -i'
alias cp='cp -i'
++ alias 'cp=cp -i'
alias mv='mv -i'
++ alias 'mv=mv -i'

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

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# are we an interactive shell?
if [ "$PS1" ]; then
  if [ -z "$PROMPT_COMMAND" ]; then
    case $TERM in
        xterm*)
                if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
                        PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
                else
            PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
                fi
                ;;
        screen)
                if [ -e /etc/sysconfig/bash-prompt-screen ]; then
                        PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
                else
            PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
                fi
                ;;
        *)
                [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
            ;;
    esac
  fi
  # Turn on checkwinsize
  shopt -s checkwinsize
  [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
fi
+++ '[' '\s-\v\$ ' ']'
+++ '[' -z '' ']'
+++ case $TERM in
+++ '[' -e /etc/sysconfig/bash-prompt-xterm ']'
+++ PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
+++ shopt -s checkwinsize
+++ '[' '\s-\v\$ ' = '\s-\v\$ ' ']'
+++ PS1='[\u@\h \W]\$ '

if ! shopt -q login_shell ; then # We're not a login shell
        # Need to redefine pathmunge, it get's undefined at the end of /etc/profile
    pathmunge () {
                if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
                        if [ "$2" = "after" ] ; then
                                PATH=$PATH:$1
                        else
                                PATH=$1:$PATH
                        fi
                fi
        }

    # By default, we want umask to get set. This sets it for non-login shell.
    # You could check uidgid reservation validity in
    # /usr/share/doc/setup-*/uidgid file
    if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
       umask 002
    else
       umask 022
    fi

        # Only display echos from profile.d scripts if we are no login shell
    # and interactive - otherwise just process them to set envvars
    for i in /etc/profile.d/*.sh; do
        if [ -r "$i" ]; then
            if [ "$PS1" ]; then
                . $i
            else
                . $i >/dev/null 2>&1
            fi
        fi
    done

        unset i
        unset pathmunge
fi
+++ shopt -q login_shell
# vim:ts=4:sw=4

# User specific environment and startup programs

export PATH=$PATH:$HOME/bin:/opt/454/bin
+ export PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/454/bin
+ PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/454/bin

export PATH
+ export PATH
unset USERNAME
+ unset USERNAME
printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"
++ printf '\033]0;%s@%s:%s\007' root G5NNJN1 '~'
[root@G5NNJN1 ~]#
Also, every command outputs something like:

Code:
[root@G5NNJN1 ~]# ls
ls
+ ls --color=tty
6                firstboot.1281463738.13  NVIDIA-Linux-x86_64-295.59.run
anaconda-ks.cfg  install.log
Desktop          install.log.syslog
printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"
++ printf '\033]0;%s@%s:%s\007' root G5NNJN1 '~'
[root@G5NNJN1 ~]#
it does not happen in user mode or after just "su", only after "su -" or login into root account. I realize that something has happened to root configuration files, but cannot quite find which one is affected as .bashrc and .bash_profile look normal.
 
Old 12-20-2012, 05:31 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
I'm thinking its your default shell for root? What shell does root have set on the /etc/passwd file? The "-" part of su - means to take on the settings of the users profile as if you logged in to that account directly, so it sources the .bashrc .bash_profile and so on, without the - it retains the current users shell, variables, etc..
 
Old 12-20-2012, 05:34 PM   #3
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
After looking at the output more it looks like root might, for some reason, have /bin/bash set in debug mode. This is usually done with the -x option to debug shell scripts. Try the following as the root user:

Code:
set +x


---------- Post added 12-20-12 at 03:34 PM ----------

http://tldp.org/LDP/Bash-Beginners-G...ect_02_03.html
 
1 members found this post helpful.
Old 12-20-2012, 06:08 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,961

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
Looks more like "-v" than "-x" ("-x" would not have printed comment lines), and "set +v" would clear it up. But, you will still need to track down where that "-v" option is getting set in the first place.
 
1 members found this post helpful.
Old 12-20-2012, 06:41 PM   #5
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
Good catch on the comments, I never use debug or verbose with Bash. The +v is the correct answer it looks like.
 
1 members found this post helpful.
Old 12-20-2012, 10:39 PM   #6
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
It's clearly because somewhere shell debug command i.e. set is set in root's shell initialization file. In order to avoid this, simply comment (put a # against the entry) the line containing set -vx (or either option associated with set) from corresponding file, as:
Code:
grep 'set' .bashrc .profile .login
Then exit from the shell and login again.
 
1 members found this post helpful.
Old 12-30-2012, 10:07 AM   #7
yaximik
Member
 
Registered: Nov 2010
Posts: 87

Original Poster
Rep: Reputation: 0
Wink [SOLVED] Why do I see this?

Thanks everyone who responded. Indeed, it was as simple as commenting out 'set -xv' in root's .bash_profile. I guess the issue was I do not remember setting this to on, otherwise I would know how to set it back to off. It got to be a goblin in my box, I hope it will not do something more malicious next time.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off




All times are GMT -5. The time now is 12:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration