- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: .sh_history security
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
Forums
Discussions
Discussions
Discussions
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
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
03-08-2005 12:12 PM
03-08-2005 12:12 PM
.sh_history security
What is the best way to disable users from being able to delete their own .sh_history? Thanks
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2005 12:29 PM
03-08-2005 12:29 PM
Re: .sh_history security
will be able to remove lines from the file. I'm not sure
how will you stop that. If you want to track all the
commands user is using, you need to come up with
another solution.
- Biswajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2005 12:38 PM
03-08-2005 12:38 PM
Re: .sh_history security
Thanks.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2005 12:52 PM
03-08-2005 12:52 PM
Re: .sh_history security
could turn on Auditing on the system that would
record all important user activities.
See:
http://docs.hp.com/en/5990-8172/ch08s09.html
- Biswajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2005 12:58 PM
03-08-2005 12:58 PM
Re: .sh_history security
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2005 01:33 PM
03-08-2005 01:33 PM
Re: .sh_history security
This is my solution
1. adding this line to the end of /etc/profile or /root home directory/.profile
#vi /etc/protile
.....
.....
HISTSIZE=0
export HISTSIZE
2. remove old history file (.sh_history) and Log out
#exit
3. Log in.
for more you cat get at:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=247729
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2005 01:46 PM
03-08-2005 01:46 PM
Re: .sh_history security
Thanks for the responses. But maybe I should try to make more clear what I want to accomplish....
I know that the .sh_history was not intended for implementing security. I also am not wanting to keep people from writing to their .sh_history files.
I am wanting to use the .sh_history for better tracking purposes. But, this is ineffective if the user can simply rm their file. I am just trying to find a way to make it impossible for a user to rm any .sh_history file. Is there something I can put in their .profiles? Or make a link to the rm command to a script that will not allow an rm of a .sh_history? Something like that. I have made links to the shutdown command that will display a warning and confirmation message before the system can be taken down (this has been handy a few times when an admin thought they were taking down a system, but were on the WRONG system). Any help you can offer is appreciated.
Thanks,
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2005 01:48 PM
03-08-2005 01:48 PM
Re: .sh_history security
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2005 03:49 PM
03-08-2005 03:49 PM
Re: .sh_history security
if [[ "${LOGNAME}" != "root" ]]
then
HISTFILE=/xxx/yyy/${LOGNAME}.hist
export HISTFILE
fi
Now, make this directory only writable by root and create a null file (or copy their existing .sh_history file to) /xxx/yyy/${LOGNAME}.hist. You need to create a file for them because they can't write to this directory BUT they can update an existing file in this directory. It's still not foolproof because they can always edit this file and I'm also unsure of the shell behavior when it needs to truncate the history file. I really don't like this because the file can be edited and any security file I have to ask "it it trustworthy" is by definition not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2005 04:07 PM
03-08-2005 04:07 PM
Re: .sh_history security
whatever you set HISTFILE to and whether you
set it in /etc/profile or user .profile, the user can
always unset HISTFILE, execute commands (s)he
does not want to be written to HISTFILE and reset
the parameter HISTFILE again. You will have no way
of finding it out.
- Biswajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2005 04:12 PM
03-08-2005 04:12 PM
Re: .sh_history security
> I am just trying to find a way to make it impossible
> for a user to rm any .sh_history file. Is there
> something I can put in their .profiles? Or make a link
> to the rm command to a script that will not allow an
> rm of a .sh_history?
But the user can always go around that. Like, for ex,
"mv .sh_history tmpfile" and "rm tmpfile". Or just use
good old vi to delete all the lines in the file, there by
making it useless for you even if (s)he can't delete the
file.
- Biswajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2005 04:15 PM
03-08-2005 04:15 PM
Re: .sh_history security
- possibly use the "script" command somewhere
- any way to exclude their shell access? (I don't know what their jobs require -- I'm thinking SAM, a restricted user that can only run sudo, something like that)
- create a custom shell that does something different with command input -- such as logging it to syslog
HTH,
Mic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2005 09:35 PM
03-09-2005 09:35 PM
Re: .sh_history security
Something like this in /etc/profile
HISTFILE=.sh_hist$$;
ln $HISTFILE /secret/${HISTFILE}.$(whoami)
Maybe put the date in there as well:
HISTFILE=.sh_hist$$;
thedate=`date +%C%y%m%d%H%M%S`
ln $HISTFILE /secret/${HISTFILE}.${thedate}.$(whoami)
You'd also have to make sure that /etc/profile is readable only by root, or they'll be able to work out the filename and delete it.
(rm /secret/* won't work, but if they know the filename, they can delete it)
Any savvy user is bound to eventually notice the "2" in the number of links column in the ll output, but without the exact filename, (or the root password) they can't do anything about it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2005 09:42 PM
03-09-2005 09:42 PM
Re: .sh_history security
All of the above is still not working.
Only when the home directory of the user is not own by it's own user .profile can't be changed. If not the user can always change there .profile and escape your auditing.
Only an external programe such as pentasave you can monitoring the user behavior.
grtz. Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2005 10:26 PM
03-09-2005 10:26 PM
Re: .sh_history security
>Ofcourse, you should be aware of the fact that,
>whatever you set HISTFILE to and whether you
>set it in /etc/profile or user .profile, the user can
>always unset HISTFILE, execute commands (s)he
>does not want to be written to HISTFILE and reset
>the parameter HISTFILE again. You will have no way
>of finding it out.
Not if you do:
HISTFILE=whatever
readonly HISTFILE
export HISTFILE
in .profile or /etc/profile
Of course, this only works for ksh & Posix
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2005 11:47 PM
03-09-2005 11:47 PM
Re: .sh_history security
Well ... by definition a user should be able to modify their histfile ... so that implies a "> histfile" would always clear it. So for the technically savvy user the way to negate this would be quite simple.
System auditing on a trusted system would most prolly be the way to go.
HTH
Gerhard