LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 05-05-2016, 09:38 AM   #1
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
How do I add mesg -n to /etc/profile?


I'm trying to prevent messages from being used as a DoS.

I'm adding

Code:
mesg -n
to /etc/profile, however when logging in I'm getting a mesg -n under the motd and I don't think that is correct.

How do I set this up correctly?

thanks
 
Old 05-05-2016, 09:41 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Did you look in /etc/login.defs, maybe comment MOTD line here
 
Old 05-05-2016, 09:45 AM   #3
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
This is under RHEL5.

I've looked under /etc/login.defs and don't see an entry for motd.

This is a STIG that I'm trying to implement and the rule is trying to have me set it up under /etc/profile. If I add it in say before the final lines of:

Code:
unset i 
unset pathmunge
I'm getting mesg -n showing up at the bottom of motd, which I have coming from /etc/issue.

thanks
 
Old 05-05-2016, 09:48 AM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
mesg -n disallows messages (-y permit), maybe it's here for a security concern

edit
correct syntax is:

mesg n (not -n)

Last edited by keefaz; 05-05-2016 at 09:51 AM.
 
Old 05-05-2016, 12:53 PM   #5
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by keefaz View Post
mesg -n disallows messages (-y permit), maybe it's here for a security concern

edit
correct syntax is:

mesg n (not -n)
mesg n worked, thanks.

Not mesg -n. Alot of the times the STIGs are written very well or easy to understand.

I looked for a man page for profile and there wasn't anything listed. So I'm wondering what mesg does under /etc/profile?

I also added it here

Code:
mesg n 

unset -i 
unset pathmunge
 
Old 05-05-2016, 01:52 PM   #6
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Quote:
Originally Posted by JockVSJock View Post

I looked for a man page for profile and there wasn't anything listed. So I'm wondering what mesg does under /etc/profile?

[/code]
There is an entry in bash manual
Code:
quote from man bash:

 When  bash is invoked as an interactive login shell, or as a non-inter-
       active shell with the --login option, it first reads and executes  com-
       mands  from  the file /etc/profile, if that file exists.  After reading
       that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
       in  that order, and reads and executes commands from the first one that
       exists and is readable.  The --noprofile option may be  used  when  the
       shell is started to inhibit this behavior.
 
  


Reply

Tags
/etc/profile, mesg -n



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to add alias to my profile ? fatou Linux - Newbie 8 04-14-2014 06:09 PM
Linux thunderbird Profile add gobinath1989 Linux - Newbie 2 09-14-2012 05:30 AM
How to add an avatar to my profile? barnac1e LQ Suggestions & Feedback 5 01-04-2012 09:36 AM
How to add a role and profile to new user in LINUX Harry_Linux008 Linux - Newbie 3 09-03-2010 02:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:10 AM.

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
Open Source Consulting | Domain Registration