Operating System - HP-UX
1838579 Members
3605 Online
110128 Solutions
New Discussion

Re: stop logging history for telnet session

 
daljit singh
New Member

stop logging history for telnet session

i want to stop the logging of my commands into the /.sh_history for my telnet session.I connect to HP servers remotely via telnet and dont want the commands run by my session to be logged into the history(only for my remote session).other users connected with same username and at the same time should be logged.
4 REPLIES 4
Biswajit Tripathy
Honored Contributor

Re: stop logging history for telnet session

I'm sure the Gurus here will give you a more
straight forward way to do this, but one way
that comes to my mind immediately is to have
a check in .profile if you are logging in from some
other system and if yes, unset HISTFILE parameter.

To check if the login is from some other system,
use "who -R am i".

The script should look something like:
who -R am i | grep -q `hostname`
if [ $? -eq 1 ]
then
unset HISTFILE
fi

I have not run the above script and obviously
it's a little over simplified, but I think you get
the basic logic used here.

- Biswajit
:-)
Thierry Poels_1
Honored Contributor

Re: stop logging history for telnet session

hi,

"other users connected with same username and at the same time should be logged"

so you want to do stuff others cannot retrace? ;-)

- unsetting HISTFILE does not work, it defaults to $HOME/.sh_history
- "HISTFILE=/dev/null" should work, but this instruction will be logged
- switching to another shell is an option if history is not configured for it. Generally companies use one shell as a standard, other shells are often not configured.

regards,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Zeev Schultz
Honored Contributor

Re: stop logging history for telnet session

Use :
export HISTSIZE=0
in the $HOME/.profile
So computers don't think yet. At least not chess computers. - Seymour Cray
Biswajit Tripathy
Honored Contributor

Re: stop logging history for telnet session

As Thierry said (and I checked :-)), unseting
HISTFILE does not work, tho' the manpage for ksh
gave me an impression that it would. But a nicer
solution would be to set the HISTFILE to a different
file for remote telnet users and leave the default
.sh_history for others.

If you want to clean up your track, make sure
to remove the change in HISTFILE entry in
.sh_history ;-)

- Biswajit
:-)