Operating System - HP-UX
1838576 Members
4247 Online
110128 Solutions
New Discussion

How do I display a message to users as they log in

 
Pamela Hammitt
Advisor

How do I display a message to users as they log in

HPUX 11.00 I need to notify users when new software is installed ,etc. How do I do that?
20 REPLIES 20
IT_2007
Honored Contributor

Re: How do I display a message to users as they log in

You can edit /etc/motd file and add your comments so that users can see it whenever they login.
James R. Ferguson
Acclaimed Contributor

Re: How do I display a message to users as they log in

Hi Pamela:

Place your message into '/etc/motd'. The file is 'cat'ed in '/etc/profile' to the user's terminal upon login if it exists.

'motd' = Message-Of-The-Day

...and is intended for uses like this.

Regards!

...JRF...
Robert-Jan Goossens
Honored Contributor

Re: How do I display a message to users as they log in

Hi Pamela,

You can create a text meesage in the /etc/issue file, this will be displayed to the users before they login.

Regards,
Robert-Jan
Jean-Yves Picard
Trusted Contributor

Re: How do I display a message to users as they log in

Hello,

before telnet login : /etc/issue

after log : /etc/copyright

Jean-Yves Picard

Pamela Hammitt
Advisor

Re: How do I display a message to users as they log in

I created a text file for /etc/motd with the message. I then checked /etc/profile. The lines that cat motd are not commented out. When I log in as a user, I don't get the message...What else do I need to check?
James R. Ferguson
Acclaimed Contributor

Re: How do I display a message to users as they log in

Hi Pamela:

Make sure that '/etc/motd' is world-readable.

Regards!

...JRF...
Pamela Hammitt
Advisor

Re: How do I display a message to users as they log in

It has permissions 755. We login using the csh. Does that matter?
Jonathan Fife
Honored Contributor

Re: How do I display a message to users as they log in

You should have a file /etc/csh.login. Take a look at that file and see if /etc/motd is cat'ed in it --

if ( -f /etc/motd ) then
cat /etc/motd # message of the day.
endif
Decay is inherent in all compounded things. Strive on with diligence
Patrick Wallek
Honored Contributor

Re: How do I display a message to users as they log in

Yes, it absolutely matters.

Instead of /etc/profile you will need to check /etc/csh.login and see if the 'cat /etc/motd' is commented out or not.
Pamela Hammitt
Advisor

Re: How do I display a message to users as they log in

The only way I got it to work is to add cat /etc/motd to the .cshrc file located in the account home directory. I guess that means I need to do that for each account's .cshrc file?
Marvin Strong
Honored Contributor

Re: How do I display a message to users as they log in

no you shouldn't be modifing each individual accounts .cshrc file set it in the system file.
because there is nothing stopping the user from removing it from their own .cshrc file. I know I would if I was a user ;p
Marvin Strong
Honored Contributor

Re: How do I display a message to users as they log in


vi /etc/motd add your message
chmod 644 /etc/motd
vi /etc/csh.login
add the following at the end of it, if it doens't exist in the file.

if ( -f /etc/motd ) then
cat /etc/motd # message of the day.
endif
James R. Ferguson
Acclaimed Contributor

Re: How do I display a message to users as they log in

Hi Pamela:

I should have guessed that you had a 'csh' :-))

OK, create '/etc/csh.login'. This should be a 'csh' script. It will be sourced (read) before '${HOME}/.cshrc' is processed. It is the analog to '/etc/profile' as used by the Posix shell.

Regards!

...JRF...
Pamela Hammitt
Advisor

Re: How do I display a message to users as they log in

I have followed Marvin Strong's directions and when I log in as a user...I get nothing. Both files are there...motd and csh.login. Permissions world has read/execute. Any other ideas?
Marvin Strong
Honored Contributor

Re: How do I display a message to users as they log in

hmm permissions on /etc/csh.login also 555 ro 755

-r--r--r-- 1 root root /etc/motd
-rwxr-xr-x 1 root root /etc/csh.login
Marvin Strong
Honored Contributor

Re: How do I display a message to users as they log in

from csh if you source /etc/csh.login
Does it give you the motd? Or do you get any errors?




Jonathan Fife
Honored Contributor

Re: How do I display a message to users as they log in

Might I also point you toward this document: http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

While what you are looking to do is definitely possible with csh, there are several reasons to switch to a more modern (and more standard) shell.
Decay is inherent in all compounded things. Strive on with diligence
Bill Hassell
Honored Contributor

Re: How do I display a message to users as they log in

ARe you using Xwindows reather than 'standard' telent or ssh logins? If so, Xwindows ignores all the normal profile steps until you tell Xwindows terminal emulators that the window is a 'login shell'. The standard /etc/profile as well as /etc/csh.login are found in /usr/newconfig/etc and there is no need to add the cat /etc/motd since it is already there.

But if the login is bypasing these profiles, you need to override this (non-Unix) behavior. Do this in *EVERY* user's $HOME directory:

echo "*loginShell: true" >> $HOME/.Xdefaults

Now you will see a 'normal' login complete with copyright message, motd message, email notification, etc.

And for interesting reading:

http://www.maths.leeds.ac.uk/~read/csh.html


Bill Hassell, sysadmin
James R. Ferguson
Acclaimed Contributor

Re: How do I display a message to users as they log in

Hi Pamela:

To add to Jonathan and Bill's suggested reading (a classic paper at that), please read the WARNINGS section of the 'csh' manpages. The 'csh' truly deserves to be jettisoned:

http://docs.hp.com/en/B2355-60127/csh.1.html

Regards!

...JRF...
Geoff Wild
Honored Contributor

Re: How do I display a message to users as they log in

If you are using ssh, you can also put a message here:

In sshd_config add:

# Banner to be printed before authentication starts.
Banner /some/path/issue



# cat /some/path/issue

Your-Company Private Network / Réseau privé de Your-Company

Avis:
L'utilisation des systèmes de Your-Company est réservée à des fins commerciales.

Toute utilisation peut faire l'objet d'une surveillance pour assurer
le respect des normes de sécurité et d'exploitation. Par conséquent,
les communications, y compris le transfert de données et le courrier
électronique, ne devraient pas être considérées privées.

Notice:
Use of Your-Company's systems is intended for business purposes.

All use can and may be monitored for security and operational
compliance and therefore communication, including data transfer
and electronic mail, should not be considered to be private.



Nice thing about that is, it is displayed before they enter their password.


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.