LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   motd appears twice (https://www.linuxquestions.org/questions/linux-newbie-8/motd-appears-twice-389126/)

JJX 12-04-2005 09:25 AM

motd appears twice
 
When i login motd file apears twice
Anyway how to trace that?
What configuration mistake :o can cause this behavior?

hussar 12-04-2005 09:46 AM

One possibility is that motd is run from /etc/profile and .profile in your home directory. Compare the content of both files and see if either of them calls motd. You should also look at .bashrc and .bash_profile if they exist.

JJX 12-04-2005 10:52 AM

Quote:

cat /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games"
fi

if [ "$PS1" ]; then
if [ "$BASH" ]; then
PS1='\u@\h:\w\$ '
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi

export PATH

umask 022

cat ~/.profile
# ~/.profile: executed by Bourne-compatible login shells.

if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
export PATH

mesg n

cat .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.

export PS1='\h:\w\$ '
umask 022

export JDK_HOME=/usr/local/lib/jdk
export CLASSPATH=$JDK_HOME
export PATH="$PATH:${JDK_HOME}/bin:${JDK_HOME}/jre/bin"

# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval `dircolors`
# alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -l'
# alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias ll='ls -la'
alias rm='rm -i'
alias vi='vim'
alias r='route -n'
#alias r0='route -n | grep wlan0'
#alias r1='route -n | grep wlan1'
#alias r2='route -n | grep wlan2'
#alias r3='route -n | grep wlan3'
alias ld='ll -d'
alias down='ifconfig wlan0 down && ifconfig wlan1 down && ifconfig wlan2 down'

.bash_profile exists only in /etc/skel

no reference to motd :(

hussar 12-04-2005 11:33 AM

OK, I was shooting from the hip and missed. I've looked at motd's man page now, and I see that /etc/motd is displayed by login "after a successful login but just before it executes the login shell."

What do you get when you do a `cat /etc/motd`? It is possible that the file carries the same message twice. (Hey, it could happen...)

What happens when you put a zero-length file called .hushlogin in your login directory? (In your home directory, do a `touch .hushlogin`.)

JJX 12-04-2005 11:49 AM

Quote:

Originally Posted by hussar
What do you get when you do a `cat /etc/motd`? It is possible that the file carries the same message twice. (Hey, it could happen...)

nah - isnt so easy :p :p :p :p

Quote:

Originally Posted by hussar
What happens when you put a zero-length file called .hushlogin in your login directory? (In your home directory, do a `touch .hushlogin`.)

i dont see the motd (0 times)

hussar 12-04-2005 12:12 PM

Hey, it was worth a shot. :)

It seems to me there are two other possibilities. Login is reading /etc/motd twice, or login is being run twice.

Either way, I'm stumped. I will be interested to see what answer you find.

jrdioko 12-04-2005 01:52 PM

Hmm, what happens if you do a "grep -r motd /*" or something along those lines to see if there's a config or startup file somewhere that might be calling it. I assume if that existed it would be in one of the places you've already looked, but it's always worth a shot to double-check everywhere.

JJX 12-04-2005 02:16 PM

Quote:

skilla:/etc# grep "/etc/motd" * -R3 |more
grep: alternatives/java: No such file or directory
default/rcS-UTC=no
default/rcS-# Set VERBOSE to "no" if you would like a more quiet bootup.
default/rcS-VERBOSE=yes
default/rcS:# Set EDITMOTD to "no" if you don't want /etc/motd to be editted automatically
default/rcS-EDITMOTD=yes
default/rcS-# Set FSCKFIX to "yes" if you want to add "-y" to the fsck at startup.
default/rcS-FSCKFIX=no
--
init.d/bootmisc.sh- fi
init.d/bootmisc.sh-
init.d/bootmisc.sh- #
init.d/bootmisc.sh: # Update /etc/motd. If it's a symbolic link, do the actual work
init.d/bootmisc.sh- # in the directory the link points to.
init.d/bootmisc.sh- #
init.d/bootmisc.sh- if [ "$EDITMOTD" != no ]
init.d/bootmisc.sh- then
init.d/bootmisc.sh: MOTD="`readlink -f /etc/motd || :`"
init.d/bootmisc.sh- if [ "$MOTD" != "" ]
init.d/bootmisc.sh- then
init.d/bootmisc.sh- uname -a > $MOTD.tmp
grep: mail/smrsh/mail.local: No such file or directory
--
rcS.d/S55bootmisc.sh- fi
rcS.d/S55bootmisc.sh-
rcS.d/S55bootmisc.sh- #
rcS.d/S55bootmisc.sh: # Update /etc/motd. If it's a symbolic link, do the actual work
rcS.d/S55bootmisc.sh- # in the directory the link points to.
rcS.d/S55bootmisc.sh- #
rcS.d/S55bootmisc.sh- if [ "$EDITMOTD" != no ]
rcS.d/S55bootmisc.sh- then
rcS.d/S55bootmisc.sh: MOTD="`readlink -f /etc/motd || :`"
rcS.d/S55bootmisc.sh- if [ "$MOTD" != "" ]
rcS.d/S55bootmisc.sh- then
rcS.d/S55bootmisc.sh- uname -a > $MOTD.tmp
grep: rcS.d/S35devpts.sh: No such file or directory
nothing interesting until here

now:
Quote:

skilla:/etc# grep "motd" * -R3 |more
grep: alternatives/java: No such file or directory
default/rcS-UTC=no
default/rcS-# Set VERBOSE to "no" if you would like a more quiet bootup.
default/rcS-VERBOSE=yes
default/rcS:# Set EDITMOTD to "no" if you don't want /etc/motd to be editted automatically
default/rcS-EDITMOTD=yes
default/rcS-# Set FSCKFIX to "yes" if you want to add "-y" to the fsck at startup.
default/rcS-FSCKFIX=no
--
init.d/bootmisc.sh- fi
init.d/bootmisc.sh-
init.d/bootmisc.sh- #
init.d/bootmisc.sh: # Update /etc/motd. If it's a symbolic link, do the actual work
init.d/bootmisc.sh- # in the directory the link points to.
init.d/bootmisc.sh- #
init.d/bootmisc.sh- if [ "$EDITMOTD" != no ]
init.d/bootmisc.sh- then
init.d/bootmisc.sh: MOTD="`readlink -f /etc/motd || :`"
init.d/bootmisc.sh- if [ "$MOTD" != "" ]
init.d/bootmisc.sh- then
init.d/bootmisc.sh- uname -a > $MOTD.tmp
grep: mail/smrsh/mail.local: No such file or directory
--
pam.d/ssh-@include common-session
pam.d/ssh-
pam.d/ssh-# Print the message of the day upon successful login.
pam.d/ssh:session optional pam_motd.so # [1]
pam.d/ssh-
pam.d/ssh-# Print the status of the user's mailbox upon successful login.
pam.d/ssh-session optional pam_mail.so standard noenv # [1]
--
pam.d/login-# (Replaces the `LASTLOG_ENAB' option from login.defs)
pam.d/login-session optional pam_lastlog.so
pam.d/login-
pam.d/login:# Prints the motd upon succesful login
pam.d/login-# (Replaces the `MOTD_FILE' option in login.defs)
pam.d/login:session optional pam_motd.so
pam.d/login-
pam.d/login-# Prints the status of the user's mailbox upon succesful login
pam.d/login-# (Replaces the `MAIL_CHECK_ENAB' option from login.defs).

--
rcS.d/S55bootmisc.sh- fi
rcS.d/S55bootmisc.sh-
rcS.d/S55bootmisc.sh- #
rcS.d/S55bootmisc.sh: # Update /etc/motd. If it's a symbolic link, do the actual work
--More--grep: rcS.d/S35devpts.sh: No such file or directory
rcS.d/S55bootmisc.sh- # in the directory the link points to.
rcS.d/S55bootmisc.sh- #
rcS.d/S55bootmisc.sh- if [ "$EDITMOTD" != no ]
rcS.d/S55bootmisc.sh- then
rcS.d/S55bootmisc.sh: MOTD="`readlink -f /etc/motd || :`"
rcS.d/S55bootmisc.sh- if [ "$MOTD" != "" ]
rcS.d/S55bootmisc.sh- then
rcS.d/S55bootmisc.sh- uname -a > $MOTD.tmp
The problem must be to italics letters ;)
How can i restart login service / pam.d or something to apply changes to these files?

jrdioko 12-04-2005 02:31 PM

I'd say comment out one of those sections and restart, but I don't know what pam is so I'll let someone else give a more informed comment.

JJX 12-04-2005 02:48 PM

pam is a sum of libraries that set the way a user will login/authenticate to the system.

any other way to restart the service without rebooting?
(i dont want to restart! uptime is bliss ;) )

jrdioko 12-04-2005 02:55 PM

You could look for the process (if it works that way) and kill and restart it, or try all the varieties of "foo/pam.d start/stop"

JJX 12-04-2005 05:13 PM

I marked as remark (nice expression :>)
in /etc/pam.d/ssh

# Print the message of the day upon successful login.
#session optional pam_motd.so # [1]

I restarted the service using
"/etc/init.d/inetd restart"

now everything works fine!
thx a lot

jrdioko 12-04-2005 05:24 PM

I was close :)

Glad you got it fixed.


All times are GMT -5. The time now is 05:26 PM.