Urgent! Motd not working !!

I have some texts in the motd file. It used to work properly, showing text when user login through telnet. But now it's not working.. the texts still in the motd file, and the file still there.... but user cannot see those texts anymore. Could anyone help me on this? Thanks.
louisalexAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
davidmwilliamsConnect With a Mentor Commented:
 It's been nice dealing with you.
  As to the login thing, hmm, I'd have to experiment, but you may find some success by looking at /etc/*tty* files.  I'm fairly sure there is a file in there somewhere (maybe something to do with getty - maybe a man getty will reveal the right filenames) which defines the prompts to give.  If you can find the right file I'm pretty confident that you can just edit the text there.
0
 
davidmwilliamsCommented:
 What are the file permissions on the /etc/motd file?  Is it possible just a   chmod 644 /etc/motd   will do the trick?
  Do the users have a .hushlogin file in their directories, which will suppress /etc/motd?
0
 
louisalexAuthor Commented:
nope... actually I even set the permission to 755 to test but still not working.
Nope..... no .hushlogin in any directories.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
davidmwilliamsCommented:
 Do your login files clear the screen in any way?  What happens if you temporarily disable your login files (.cshrc, .login, .profile, .bash_profile, .bashrc ... these sort of things) - just by renaming them with .bak at the end, or moving them to another directory (don't actually delete them!).
  Also, are you logging in via X-Windows, or this a terminal based login?
0
 
louisalexAuthor Commented:
I logged in through telnet. Nope, the login files didn't clear the screen.
0
 
davidmwilliamsCommented:
 Can you kindly copy all the output you get from the telnet command through to the Unix prompt?
  Also, once logged in, can you do an ls -l /etc/motd and then a cat /etc/motd ?

Thanks.
0
 
louisalexAuthor Commented:
hmm... I think probably my server got hacked. Something new come in...in the past, when I telnet in the server, it should look like
Welcome.
login:
password:
motd messages
servername:~$

now it become

Welcome:
servername.domain.com login:
password:
servername:~$

weird...

ls -l /etc/motd
-rw-r--r--   root  root  
cat /etc/motd
**********
Policies:
blah.....blah...blah....
**********
something like that...


0
 
davidmwilliamsCommented:
 Ok, hmm
  Check /etc/profile and see if the line to cat /etc/motd is still in there.  It should look something like this -

        if [ ! -f .hushlogin ]
        then
                /usr/sbin/quota
                trap "trap '' 2"  2
                /bin/cat -s /etc/motd

   etc. ...

 or  /etc/.login if using a csh type shell, in which case the lines should look something like this ...

if (! -e .hushlogin ) then
        /usr/sbin/quota
        /bin/cat -s /etc/motd

  etc ....

  If these lines are missing, then I'd expect this is the problem - because /etc/motd is not displayed 'automatically' per se, it is displayed as a consequence of the lines in these files which get executed when people log in, before their own startup files.
  If there is nothing to cat /etc/motd in those files, then check their modification times with

  ls -l /etc/profile /etc/.login

  and see if they have been modified recently, and if so, if it is about the same time you stopped getting the motd.
0
 
louisalexAuthor Commented:
I never have those things in my /etc/profile but it used to show up those motd messages. Just few weeks ago it stopped showing. Don't know why.
Could you please write me the complete lines of that cat /etc/motd for me so that I can try whether it works or not. And where should I put it in /etc/profile? end or beginning? Thanks very much for your comment. I really appreciate your help. Thanks.
0
 
davidmwilliamsCommented:
 Here's my complete /etc/profile -- you can find the lines to cat /etc/motd in the middle.
  If your /etc/profile does not contain these lines, do you know if it has been edited recently?  What is the date stamp on it?
  Perhaps your login shell has changed, and the shell you were using did cat /etc/motd in its startup file?
  Anyway -- see if adding these lines to your /etc/profile does the trick for you.  Do keep me informed.


#ident  "@(#)profile    1.17    95/03/28 SMI"   /* SVr4.0 1.3  */

# The profile that all logins get before using their own .profile.

trap ""  2 3
PATH=/opt/SUNWspro/bin:/bin:/usr/bin:/usr/ucb:/usr/sbin:/ust/dt/bin:/usr/openwin/bin:/usr/local/bin:/usr/local/java/bin:/usr/ccs/bin:/usr/X11R6/bin:/opt/texmf/bin:/opt/netscape:/usr/local/microsoft/bin
export LOGNAME PATH

if [ "$TERM" = "" ]
then
        if /bin/i386
        then
                TERM=AT386
        else
                TERM=sun
        fi
        export TERM
fi

#       Login and -su shells get /etc/profile services.
#       -rsh is given its environment in its .profile.

case "$0" in
-sh | -ksh | -jsh)

        if [ ! -f .hushlogin ]
        then
                /usr/sbin/quota
                #       Allow the user to break the Message-Of-The-Day only.
                trap "trap '' 2"  2
                /bin/cat -s /etc/motd
                trap "" 2

                /bin/mail -E
                case $? in
                0)
                        echo "You have new mail."
                        ;;
                2)
                        echo "You have mail."
                        ;;
                esac
        fi
esac

MANPATH=/usr/man:/usr/local/man:/usr/X11R6/man:/usr/openwin/man:/usr/dt/man:/opt/texmf/doc/man
LD_LIBRARY_PATH=/usr/openwin/lib:/usr/X11R6/lib:/usr/dt/lib
CLASSPATH=/usr/local/java/lib/classes.zip
MOZILLA_HOME=/opt/netscape
PRINTER=mailroom
LPDEST=mailroom
EDITOR=vi
export MANPATH LD_LIBRARY_PATH CLASSPATH MOZILLA_HOME
export PRINTER LPDEST EDITOR

umask 022
trap  2 3
0
 
louisalexAuthor Commented:
and no one modified the /etc/profile recently.
0
 
louisalexAuthor Commented:
wow.. you are fast... I am not so sure about the /etc/profile. Here is my /etc/profile. Please have a look and see where can I put it in. And what os you are using because yours looks a lot different than mine. Just curious.. My login shell is /bin/bash.

# /etc/profile

# System wide environment and startup programs
# Functions and aliases go in /etc/bashrc

PATH="$PATH:/usr/X11R6/bin:/usr/bin:usr/sbin"
PS1='\h:\w\$ '
PS2='> '
ulimit -c 1000000
if [ `id -gn` = `id -un` -a `id -u` -gt 14 ]; then
      umask 022
else
      umask 022
fi

#USER=`id -un`
USER=`whoami`
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
HISTFILESIZE=1000
export PATH PS1 PS2 HOSTNAME HISTSIZE HISTFILESIZE USER LOGNAME MAIL

for i in /etc/profile.d/*.sh ; do
      if [ -x $i ]; then
            . $i
      fi
done

unset i

0
 
davidmwilliamsCommented:
 I'm using Solaris.
  I don't think there's probably any place to put the cat /etc/motd that is particularly better than anywhere else.
Let's go for this ...

# /etc/profile

# System wide environment and startup programs
# Functions and aliases go in /etc/bashrc

PATH="$PATH:/usr/X11R6/bin:/usr/bin:usr/sbin"
PS1='\h:\w\$ '
PS2='> '
ulimit -c 1000000
if [ `id -gn` = `id -un` -a `id -u` -gt 14 ]; then
   umask 022
else
   umask 022
fi

if [ ! -f .hushlogin ]; then
   cat -s /etc/motd
fi

#USER=`id -un`
USER=`whoami`
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
HISTFILESIZE=1000
export PATH PS1 PS2 HOSTNAME HISTSIZE HISTFILESIZE USER LOGNAME MAIL

for i in /etc/profile.d/*.sh ; do
if [ -x $i ]; then
    . $i
fi
done

unset i


  As an aside, the lines to set the umask can all be replaced with just a   umask 022   because the same value is being used, regardless of the if condition.
0
 
louisalexAuthor Commented:
wow.. you are fast... I am not so sure about the /etc/profile. Here is my /etc/profile. Please have a look and see where can I put it in. And what os you are using because yours looks a lot different than mine. Just curious.. My login shell is /bin/bash.

# /etc/profile

# System wide environment and startup programs
# Functions and aliases go in /etc/bashrc

PATH="$PATH:/usr/X11R6/bin:/usr/bin:usr/sbin"
PS1='\h:\w\$ '
PS2='> '
ulimit -c 1000000
if [ `id -gn` = `id -un` -a `id -u` -gt 14 ]; then
      umask 022
else
      umask 022
fi

#USER=`id -un`
USER=`whoami`
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
HISTFILESIZE=1000
export PATH PS1 PS2 HOSTNAME HISTSIZE HISTFILESIZE USER LOGNAME MAIL

for i in /etc/profile.d/*.sh ; do
      if [ -x $i ]; then
            . $i
      fi
done

unset i

0
 
louisalexAuthor Commented:
well, error message come to

bash :[!: command not found

but without those if thing, just type cat -s /etc/motd
it shows up the messages...

0
 
davidmwilliamsCommented:
 Excellent, so you are seeing the message now, upon login?
You need to just make sure there is a space between the [ and the ! in the if line, like so

  if [ ! -f .hushlogin ]; then

.

  However, this if statement is just to suppress /etc/motd being displayed if the user has a .hushlogin file in their account, which you may not need to worry about.  That is, you can certainly delete the if statement and just have the cat -s /etc/motd
0
 
louisalexAuthor Commented:
but without the if thing.. now even when I su -l
the /etc/motd message also come out... it used to won't show up again when I su -l

0
 
louisalexAuthor Commented:
and how about the servername appear infront of the login. That really piss me off....
yup.. got it.... I leave a space infront of ! then it worked... now it is the login stuff.... please help me on this.... Thanks..

0
 
louisalexAuthor Commented:
and how about the servername appear infront of the login. That really piss me off....
yup.. got it.... I leave a space infront of ! then it worked... now it is the login stuff.... please help me on this.... Thanks..

0
 
louisalexAuthor Commented:
and how about the servername appear infront of the login. That really piss me off....
yup.. got it.... I leave a space infront of ! then it worked... now it is the login stuff.... please help me on this.... Thanks..

0
 
davidmwilliamsCommented:
 Ok, so, what are we up to now?
  You get the motd being shown when you login, as you wanted, but it is also being displayed when you su - ?
  That, actually, is the correct behaviour because the - tells su to act like you've just logged in as root (or some other user).  If you use just su by itself (without the -) then you will become the superuser but without executing the login files.
0
 
louisalexAuthor Commented:
Oh I see, thanks very much. So, do you know how to fix the login thing? It used to just have login: but now is servername login: . Anyway, please answer the question, simply write something so that I can give you the points you deserve. Thanks very much.
0
 
louisalexAuthor Commented:
It's been nice dealing with you too. Thanks very much for your answers. I really appreciate your help. Thanks. Talk to you next time. Seeya. I will look into the tty thing, hope will get something out.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.