1830898 Members
2971 Online
110017 Solutions
New Discussion

Message of the day

 
SOLVED
Go to solution
vaman
Frequent Advisor

Message of the day

On hpux 11.0, how can I give message when a user logs in first time, & if I need to restrict to a perticular group a perticular message, how can I do that
vaman kulkarni
9 REPLIES 9
Mark Greene_1
Honored Contributor

Re: Message of the day

You can edit the file /etc/motd with whatever you want. Legal disclaimers are a popular choice here, as this is displayed to all logins.

To restrict by group, you could edit the /etc/profile to print a message on certain conditions, such as a login IDs group affiliation (man groups for more info).

mark
the future will be a lot like now, only later
Franky_1
Respected Contributor

Re: Message of the day

Hi,

you can use the news command which displays contents of files under /var/news upon login
Read man news for more info

Regards

Franky
Don't worry be happy
Simon Hargrave
Honored Contributor
Solution

Re: Message of the day

The default profile displays the contents of /etc/motd for this very purpose. Put your contents in this file.

The part in /etc/profile that calls it looks like this: -

# Message of the day

if [ -r /etc/motd ]
then
cat /etc/motd
fi

To restrict it to a certain group, eg GID 110, you could modify this to

# Message of the day

if [ -r /etc/motd -a $(id -g) -eq 110 ]
then
cat /etc/motd
fi

If you wanted different messages for different groups, you could have: -

# Message of the day

gid=$(id -g)

if [ -r /etc/motd.$gid ]
then
cat /etc/motd.$gid
fi

Then have /etc/motd.100 , /etc/motd.110 etc.
vaman
Frequent Advisor

Re: Message of the day

I do not have /etc/motd still I get some message every time I login, it is not from/etc/profile or.profile.
The messages are like last successful login, last unsuccessful login & some notice,
Can i know where it is comming from?
vaman kulkarni
Simon Hargrave
Honored Contributor

Re: Message of the day

The last successful login messages etc are generated by the "login" process upon successful authentication, before the profiles are executed.

Not sure what you mean by "notice"? Perhaps you mean a banner displayed before the login: prompt? If so then check /etc/inetd.conf for the telnet service. It may have -b /etc/issue which means it displays the contents of that file before login.
vaman
Frequent Advisor

Re: Message of the day

Hello Simon,

Yes I mean banners, last login info displayed before I get prompt, but it is not from /etc/issue as I checked the contents of that file,
Also I am not using telnet but ssh
vaman kulkarni
vaman
Frequent Advisor

Re: Message of the day

IF I am using SSH to connect hpux system, what is the file that will give me banner before shell prompt
vaman kulkarni
Mark Greene_1
Honored Contributor

Re: Message of the day

sshd will display /etc/motd, unless disabled in the config file /etc/sshd.config or $HOME/.ssh/config. Alternate files may be specified in $HOME/.ssh/environment, $HOME/.ssh/rc or other files in that directory path, depending on your ssh implementation.

mark
the future will be a lot like now, only later
Cheryl Griffin
Honored Contributor

Re: Message of the day

You might be looking for /etc/issue except /etc/issue will not display a message to users whom telnet into the machine.
"Downtime is a Crime."