Operating System - HP-UX
1833707 Members
2360 Online
110063 Solutions
New Discussion

No banner for non-interactive sessions !!

 
SOLVED
Go to solution
Whitehorse_1
Frequent Advisor

No banner for non-interactive sessions !!

Halo admins,

How can we avoid banner for non-interactive logins. I got a script scheduled in cron which does 'su - somusr -c script > testfile'.
The output gathers banner ie., Copyright stuffs...and atlast collects the output of the script. How can I avoid getting such 'Copyright..Stufffs', and just my script output..

-- WH
Reading is a good course medicine for deep sleep !!
10 REPLIES 10
Heironimus
Honored Contributor

Re: No banner for non-interactive sessions !!

As I recall, most HP systems are set to display that stuff in /etc/profile. "su - user -c script" will always run the profile because you're requesting a login session. "su user -c script" and "sudo -u user script" shouldn't show the copyright because they shouldn't run the profile, but the script may fail because it doesn't have the environment it expects to find (this is usually an easy fix).
Todd McDaniel_1
Honored Contributor

Re: No banner for non-interactive sessions !!

The local .profile can override the /etc/profile. There might be a way to do it with that.

Also, if you don't need the additional environment variables of the new user being su'ed to, then you can leave off the dash portion of the su command. I believe it shouldn't read the /etc/profile when logging in.


Otherwise, if your output file has the same number of lines, then you can add "tail -xxx " into your output line to chop off the header of the banner.
Unix, the other white meat.
Shannon Petry
Honored Contributor

Re: No banner for non-interactive sessions !!

The local .profile can not over-ride the /etc/profile, as /etc/profile is called first. Outside of that, remove the "-" and make sure your script handles any pathing beyond "/bin".

Microsoft. When do you want a virus today?
Victor Fridyev
Honored Contributor
Solution

Re: No banner for non-interactive sessions !!

Hi,

Comment out the string
cat /etc/copyright
in /etc/profile and you'll get what you want.
If you want to see this in interactive sessions, you'll have to analize additional conditions.

HTH
Entities are not to be multiplied beyond necessity - RTFM
Shannon Petry
Honored Contributor

Re: No banner for non-interactive sessions !!

I would not recommend relying on removing /etc/copyright as a fix. This file is provided by the OS for a reason, and will possibly be put back with a patch. In addition to /etc/copyright, /etc/motd would also be displayed on a "su - $ID" log in. /etc/motd can be site modified without issue.

It's best to work with what the OS gives you. If you change the OS files, a patch can quickly break you again.
Microsoft. When do you want a virus today?
Juan M Leon
Trusted Contributor

Re: No banner for non-interactive sessions !!

I think you can do it this way
First option remove "-" between su and somusr
'su somusr -c script > testfile'
James R. Ferguson
Acclaimed Contributor

Re: No banner for non-interactive sessions !!

Hi:

Strictly speaking, you cannot/should not remove the copyright message. You *can* however reduce it to an officially sanctioned two-sentence note. See Technical Knowledge Base ID # emr_na-c00932256-1 .

Regards!

...JRF...
Todd McDaniel_1
Honored Contributor

Re: No banner for non-interactive sessions !!

Variables set in a user's .profile most certainly can override /etc/profile.

Most commonly done where the umask is set differently for certain users like Oracle.

It can't be done to prevent the banner from displaying since that is called from /etc/profile.

Unix, the other white meat.
Aashique
Honored Contributor

Re: No banner for non-interactive sessions !!

Hi,
Please check the file /etc/profile. All options are there. If you dont want the "Copyright info" please block the line
# cat /etc/copyright

Thanks & Regards

A. Aashique
Whitehorse_1
Frequent Advisor

Re: No banner for non-interactive sessions !!

Thanks all for your response.

I was looking exactly what Juan said, and agreed not to remove 'copyright'file.

Closing this thread...

-- WH
Reading is a good course medicine for deep sleep !!