- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Clear .sh_history when log off
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2009 08:16 AM
тАО06-23-2009 08:16 AM
I would like to exec a script when i log off putty, telnet, xterm session to clear out .sh_history.
Please tell me where can i put this script.
Regards,
Tom
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2009 08:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2009 08:28 AM
тАО06-23-2009 08:28 AM
Re: Clear .sh_history when log off
Mel's solution may blast it for each script you run?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2009 09:58 AM
тАО06-23-2009 09:58 AM
Re: Clear .sh_history when log off
i only have one .sh_history
Mel- this line works when i add it to the bottom of the .profile
Question:
Can i hide this line from .profile
when i move this line up within .profile it does not seem to work.
Reason: do not want user to see it.
Regards,
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2009 10:19 AM
тАО06-23-2009 10:19 AM
Re: Clear .sh_history when log off
Did you do this in the ${HOME}/.profile or in '/etc/profile'?
If you did this in '/etc/profile' you need to put it at the end since there is (by default) a 'trap' for the signals in question already there. This would override Mel's suggestion if you don't put his last.
Security by obsurity is weak. Any user can list ('cat', etc.) '/etc/profile' to see what you have done.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2009 11:04 AM
тАО06-23-2009 11:04 AM
Re: Clear .sh_history when log off
The reason stuff is kept in these files is so there is a record of what was done when.
This is a basic security measure and helps you catch your own mistakes.
Doing what you propose probably violates security audit parameters and is not a good idea.
Modify the ideas above to at least archive this information so its available when you need it.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2009 02:36 PM
тАО06-23-2009 02:36 PM
Re: Clear .sh_history when log off
> SEP: The reason stuff is kept in these files is so there is a record of what was done when.
This is a basic security measure and helps you catch your own mistakes. Doing what you propose probably violates security audit parameters and is not a good idea.
I'm sorry to disagree, but I do! This is _no_ audit if you consider that the owner of the history file has every right to truncate the file before he/she logs off. In fact, I routinely do this when I have issued a 'shutdown' command as root. I don't want to be able to inadvertently recall the command history looking for a command that lay next to the 'shutdown' and stupidly re-trigger that shutdown again by mistake!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2009 05:13 PM
тАО06-23-2009 05:13 PM
Re: Clear .sh_history when log off
If the purpose is auditing users in the sense of what they have done, then an external solution needs to be involved, like power broker, where you can log every key stroke of the user onto an external server, unreachable by the end user. Then it is a valid auditable log.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2009 05:54 PM
тАО06-23-2009 05:54 PM
Re: Clear .sh_history when log off
As long as you aren't root (or you use ksh), you still will have a history.
In regards to Mel's solution, that will blast it for every shell script you run.
You would need to do:
shell=$(UNIX95=EXTENDED_PS ps -p $$ -ocomm=)
if [[ "$shell" = -* ]]; then
echo "Login shell: $shell"
> $HISTFILE
fi
Or using it in a trap command:
trap 'shell=$(UNIX95=EXTENDED_PS ps -p $$ -ocomm=)
if [[ "$shell" = -* ]]; then
#echo "Login shell: $shell"
> $HISTFILE
fi' 0 1 3 15
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-24-2009 08:29 AM
тАО06-24-2009 08:29 AM
Re: Clear .sh_history when log off
Regards,
Tom