Ethernet Switching
Reply
Contributor
Deimark
Posts: 41
Registered: ‎08-05-2009
0

Question for MOTD on EX switches

Hi all

 

I have a problem here where someone has set up a MOTD as a login announcement (ie after the the user logs in) but there is nothing in the config under system > login that sets any form of meesage.

 

There is an entry within the /etc/motd file which reflects the message however when I edit the file (as root user) and save it, after a reboot the motd is back.

 

Any ideas on how to get rid of this permanently?

 

TIA

 

DM

--
DM

JNCIP-SEC, JNCIP-ENT, JNCIS-SEC, JNCIS-ENT, JNCIS-FWV, JNCIS-SSL,JNCIA-AC, JNCIA-IDP

-----------
The art of diplomacy is saying "nice doggy" til you can find a rock.
Distinguished Expert
MMcD
Posts: 623
Registered: ‎07-20-2010
0

Re: Question for MOTD on EX switches

Weird one,  did you use commit full just as a matter of interest?

MMcD [JNCIP-SEC, CCNA, MCP]
____________________________________________________

[Please Mark My Solution Accepted if it Helped, Kudos are Appreciated Too]
Contributor
Deimark
Posts: 41
Registered: ‎08-05-2009
0

Re: Question for MOTD on EX switches

There is no config to commit here, so the commit full will make no difference sadly.

 

It seems that someone has messed around with the system files in BSD which are overriding the junos config.

 

Anyone else able to help here?

 

I know I can fix this by reformatting the device but this is a rather large hammer to fix a small and cosmetic issue.

--
DM

JNCIP-SEC, JNCIP-ENT, JNCIS-SEC, JNCIS-ENT, JNCIS-FWV, JNCIS-SSL,JNCIA-AC, JNCIA-IDP

-----------
The art of diplomacy is saying "nice doggy" til you can find a rock.
Distinguished Expert
MMcD
Posts: 623
Registered: ‎07-20-2010
0

Re: Question for MOTD on EX switches

From freebsd below,  might be related to your issue.

 

The /etc/motd file is edited upon every boot of the system, replacing everything up to, but not including, the first blank line with the system's kernel version information. When editing this file, make sure that you start after this blank line, to keep /etc/rc from deleting these lines when it edits /etc/motd upon boot.

MMcD [JNCIP-SEC, CCNA, MCP]
____________________________________________________

[Please Mark My Solution Accepted if it Helped, Kudos are Appreciated Too]
Contributor
Deimark
Posts: 41
Registered: ‎08-05-2009
0

Re: Question for MOTD on EX switches

Hiya bud

 

Thanks fo rthe info but I did try this before with no luck, it seems that on every boot the motd is updated again.

 

Sadly I cant find the file that defines the message to update this motd so am at a loss here.

 

Ah well, looks like I may need to reformat the device.

 

Thanks for your help though

 

 

DM

--
DM

JNCIP-SEC, JNCIP-ENT, JNCIS-SEC, JNCIS-ENT, JNCIS-FWV, JNCIS-SSL,JNCIA-AC, JNCIA-IDP

-----------
The art of diplomacy is saying "nice doggy" til you can find a rock.
Contributor
grim
Posts: 15
Registered: ‎09-01-2009
0

Re: Question for MOTD on EX switches

[ Edited ]

Upon examination of the /etc/rc.local on JUNOS 10.4R2.6, 10.4R6.5 and 10.4R9.2,  the /etc/motd during startup or bootup is replaced by either:

  • /etc/motd.sys ( A creation of an extraction of uname and possibilty of a warning for alternate root slice. /tmp/_motd is the temporary workfile)
  • A concatenation of /etc/motd.sys, a blank line, /var/etc/motd.junos

Later, /usr/sbin/check-support may append data to /etc/motd

 

 

Contributor
JulioCassettez
Posts: 76
Registered: ‎12-08-2010
0

Re: Question for MOTD on EX switches

You can grep for something in the MOTD to attempt to locate the source of the text.  For example, I don't have an MOTD configured, so when I login, I just get the default of the JUNOS version:

 

login: dude Password: --- JUNOS 10.4R8.5 built 2011-11-19 07:23:29 UTC dude@ex3200-1> 

 

So if I drop to the shell, su to root (so I don't get a bunch of "permission denied") and search for the files that contain the word "built" in the /etc/ directory (or wherever you think the file may be):

 

dude@ex3200-1> start shell % su Password: root@ex3200-1:RE:0% grep built /etc/* grep: /etc/hosts.allow: No such file or directory /etc/motd:--- JUNOS 10.4R8.5 built 2011-11-19 07:23:29 UTC /etc/motd.sys:--- JUNOS 10.4R8.5 built 2011-11-19 07:23:29 UTC /etc/rc.local:# replace '(kernelName) #0:' with 'built' so that only engineering /etc/rc.local:uname -v | sed -e 's,^\([^#]*\) #\(.* UTC\).*/\([^/]*\) $,--- \1 (\3) #\2,' -e 's/ ([A-Za-z0-9_][^)]*) #0: / built /' > $T grep: /etc/skeykeys: No such file or directory root@ex3200-1:RE:0% 

 

Contributor
JulioCassettez
Posts: 76
Registered: ‎12-08-2010
0

Re: Question for MOTD on EX switches

Oops.... it didn't seem to like my "new line" characters.  But you get the idea.  If you grep for the word "built" you'll see which files contain them.

Contributor
JulioCassettez
Posts: 76
Registered: ‎12-08-2010
0

Re: Question for MOTD on EX switches

// let's try this again:

 

ex3200-1 (ttyp1)

login: dude
Password:

--- JUNOS 10.4R8.5 built 2011-11-19 07:23:29 UTC
dude@ex3200-1>

 

 

 

dude@ex3200-1> start shell
% su
Password:
root@ex3200-1:RE:0% grep built /etc/*
grep: /etc/hosts.allow: No such file or directory
/etc/motd:--- JUNOS 10.4R8.5 built 2011-11-19 07:23:29 UTC
/etc/motd.sys:--- JUNOS 10.4R8.5 built 2011-11-19 07:23:29 UTC
/etc/rc.local:# replace '(kernelName) #0:' with 'built' so that only engineering
/etc/rc.local:uname -v | sed -e 's,^\([^#]*\) #\(.* UTC\).*/\([^/]*\) $,--- \1 (\3) #\2,' -e 's/ ([A-Za-z0-9_][^)]*) #0: / built /' > $T
grep: /etc/skeykeys: No such file or directory
root@ex3200-1:RE:0%

Contributor
Deimark
Posts: 41
Registered: ‎08-05-2009
0

Re: Question for MOTD on EX switches

Hiya bud, thanks for posting.

 

I did try all those things, grepping for the content of the MOTD to sewe where the info was coming from originally and found nothing sadly.

 

However, strangely enough, I must have done something right cos the motd is not there anymore.  So my sequence of random reboots, standard install of Junos (not a complete a reformat) seems to have corrected it.

 

Still bloody wierd that it happened in the 1st place but it seems the issue is resolved for now.

 

Thanks all

 

DM

--
DM

JNCIP-SEC, JNCIP-ENT, JNCIS-SEC, JNCIS-ENT, JNCIS-FWV, JNCIS-SSL,JNCIA-AC, JNCIA-IDP

-----------
The art of diplomacy is saying "nice doggy" til you can find a rock.
Copyright© 1999-2013 Juniper Networks, Inc. All rights reserved.