Operating System - HP-UX
1763065 Members
2901 Online
108909 Solutions
New Discussion юеВ

Re: remsh and login messages

 
SOLVED
Go to solution
Scott E Smith
Frequent Advisor

remsh and login messages

I am doing an su from root to another account and issuing a subsequent remsh command. ALl of the output is being re-directed to a file but the file is full of the information in the /etc/copyright file. Is there any way to avoid this? Thanks.
7 REPLIES 7
Shannon Petry
Honored Contributor

Re: remsh and login messages

Yes and no. Yes you can zero out the copyright file. I'd recommend backing up the old one for possible legal reasons. I.E.
cp -p /etc/copyright /etc/copyright_orig
cat /dev/null >/etc/copyright

FYI it is not the "su" causing the problem, but the remsh. If no session is established in recex, rsh, rlogin then the /etc/copyright and /etc/motd are displayed as this becomes a login session.

Regards,
Shannon
Microsoft. When do you want a virus today?
someone_4
Honored Contributor

Re: remsh and login messages

Do you want to disable the copyright info for all users?
To do that in /etc/profile

comment out /etc/copyright.

#cat /etc/copyright


~ Richard
Scott E Smith
Frequent Advisor

Re: remsh and login messages

Might then there be a better way than remsh? I tried rexec but it requires a password.
T. M. Louah
Esteemed Contributor
Solution

Re: remsh and login messages

.: check the difference between :
# su - username
AND
# su username

Cheers!
PAP (a.k.a pliz assign points)!
Little learning is dangerous!
Scott E Smith
Frequent Advisor

Re: remsh and login messages

That didt. Thanks T.M.
harry d brown jr
Honored Contributor

Re: remsh and login messages


You could fgrep -v -f /etc/copyright outputscriptpath

live free or die
harry
Live Free or Die
Bill Hassell
Honored Contributor

Re: remsh and login messages

This is a very common problem. /etc/profile and .profile must be rewritten to bypass terminal-specific code. That's because cron jobs and remsh's do not have a controlling terminal. Thus, commands that are appropriate for an interactive login must be bypassed when there is no terminal.

To determine whether this session is interactive, you can use:

if [ -o interactive ]
then
export INTERACTIVESHELL=/sbin/true
else
export INTERACTIVESHELL=/sbin/false
fi

Now when a command such as ttytype or tset or the copyright message appears, run these commands only when INTERACTIVESHELL is true:

if $INTERACTIVE
then
eval $(ttytype -s)
fi

And here's a solution for the long copyright message:

# This meets legal requirements...without the long message

if $INTERACTIVE
then
echo "\nThe copyright notice can be read by typing: cat /etc/copyright\n"
fi

Now, the message won't appear at all if the shell is not interactive and if it is, only the one-liner will be shown.


Bill Hassell, sysadmin