LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 12-15-2004, 12:01 PM   #1
yanik
Member
 
Registered: Oct 2003
Location: Montreal Beach
Distribution: Debian Unstable
Posts: 368

Rep: Reputation: 30
Protecting myself...lol


I just found the command 'history' which gives the last 1000 command I enter in a shell. Let's say I'm not the admin and I don't want him to see what I try to do, how do I delete the history? I deleted the file /home/yanik/.bash_history but when I run the command history after that, the first command is rm .bash_history!!!! dammit! lol . I though I could do a little script that would execute something like ls a thousand time, which seems to work, but is there a cleaner way? Because it is still suspicious to ls the same dir 1000 time lol.

Anyway to have some privacy?

Yanik
 
Old 12-15-2004, 12:11 PM   #2
ror
Member
 
Registered: May 2004
Distribution: Ubuntu
Posts: 583

Rep: Reputation: 33
zero-byte it then change it's permissions I guess? There's probably a neater setting for it somewhere.
 
Old 12-15-2004, 12:12 PM   #3
FLOODS
Member
 
Registered: Aug 2003
Location: GA
Distribution: Fedora Core 4 Desktop/Server.
Posts: 361

Rep: Reputation: 30
history -c clears the history
I set my .bash_logout to do this every time I logout. I have mine to clear, rm -rf .bash_history, and then history -c
keep it last so nothing's really seen
 
Old 12-15-2004, 12:14 PM   #4
yanik
Member
 
Registered: Oct 2003
Location: Montreal Beach
Distribution: Debian Unstable
Posts: 368

Original Poster
Rep: Reputation: 30
lol, that's just great, thanks guys
 
Old 12-15-2004, 01:53 PM   #5
wmakowski
Member
 
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 25, 26, RHL 5.2
Posts: 560

Rep: Reputation: 56
Just to add a little to the history discussion. The environment variable HISTSIZE will allow you to adjust the number of commands kept in history.

Bill
 
Old 12-15-2004, 02:09 PM   #6
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Re: Protecting myself...lol

Quote:
Originally posted by yanik
Let's say I'm not the admin and I don't want him to see what I try to do, how do I delete the history?
Let's say the admin want's to see what you're doing, and you want to stop him. You think you can actually do that?! You would probably only succeed in raising a big 'ol red flag for your efforts, if you have a sharp sysadm. People who try to hide what they're doing (should) raise suspicions. You might end up having yourself watched keystroke by keystroke via ttysnoop or some other such tool.
 
Old 12-15-2004, 02:22 PM   #7
FLOODS
Member
 
Registered: Aug 2003
Location: GA
Distribution: Fedora Core 4 Desktop/Server.
Posts: 361

Rep: Reputation: 30
seems like this is his own system he's messing with, but I agree entirely if it's not his system.
You will definitely just raise a red flag on yourself, there are many other ways that admins can watch you keystroke for keystroke. clearing the history would only do any good to someone connecting to your machine and using it for malicious purposes. then it wouldn't do a *lot*
 
Old 12-15-2004, 02:45 PM   #8
uphu
Member
 
Registered: Dec 2004
Posts: 44

Rep: Reputation: 15
Why would you ever need to clear your history? Its so useful...
 
Old 12-15-2004, 04:21 PM   #9
yanik
Member
 
Registered: Oct 2003
Location: Montreal Beach
Distribution: Debian Unstable
Posts: 368

Original Poster
Rep: Reputation: 30
no it's not on my system, and I guess you are all right. I'll mess at home on my system instead of trying to be a smart ass at work
 
Old 12-17-2004, 10:35 AM   #10
cormander
Member
 
Registered: Dec 2004
Location: Hawaii
Distribution: Fedora & CentOS
Posts: 72

Rep: Reputation: 15
How about instead of removing it, you simply alter it?

A good way to alter it w/o the altering itself being recorded, is setting up a crontab entry.

Pick commands you don't want them to know you're doing, and have them sub'd for basic commands like "ls" or "cd"

You may want to use perlpie for this:

*/5 * * * * /usr/bin/perl -pi -e "s/command1/command2/g" ~/.bash_history

There are other ways to make this less obvious as to what you are doing, like writting a c program using system() calls to the shell, or a perl script compiled with perlcc

-Corey
 
Old 12-17-2004, 11:19 AM   #11
Cron
Member
 
Registered: Jun 2004
Location: Lithuania
Distribution: FreeBSD, Arch, Ubuntu
Posts: 145

Rep: Reputation: 15
Best solution IMHO (and the easyest) is to symlink .bash_history with /dev/null .
 
Old 12-17-2004, 11:24 AM   #12
cormander
Member
 
Registered: Dec 2004
Location: Hawaii
Distribution: Fedora & CentOS
Posts: 72

Rep: Reputation: 15
Or how about the crontab checks to see if .bash_history is a symlink, and if not, removes it and makes it a symlink to /dev/null

That way if the admin find out about the symlink, you can really piss em off

-Corey
 
Old 12-17-2004, 12:01 PM   #13
Cron
Member
 
Registered: Jun 2004
Location: Lithuania
Distribution: FreeBSD, Arch, Ubuntu
Posts: 145

Rep: Reputation: 15
Good idea. But what about admin EDITING YOUR CRONTAB? Nothing is impossible tough.
 
Old 12-17-2004, 12:06 PM   #14
cormander
Member
 
Registered: Dec 2004
Location: Hawaii
Distribution: Fedora & CentOS
Posts: 72

Rep: Reputation: 15
Then you've got an admin who has atleast half-a-brain. I've seen plenty of server "admins" who don't know jack about what they are doing, and the crontab trick usually stumps them.

Anyway, another trick to get around this is to have a background process running that sits there and checks your crontab. If it changes, it puts it back. And have the process ignore all signals to make it hard to kill.

Of course there is a way for the admin to get rid of that, but there comes a point where it is he who knows more, being the one who comes out on top.

And the final question is: is having your .bash_history file not recording your history really THAT important?

I guess we'll never know.

-Corey
 
Old 12-17-2004, 03:29 PM   #15
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
I guess if you have a sysadm as green as the ones cormander has been blessed(?) with, it doesn't really matter if you hide your shell history or not. They'd be too inexperienced to locate even those files! acctcom, /var/cron/log, PAM, and all kinds of other places can turn up tons of detail on your activities. Tracking down an experienced cracker who has already gained root access can be tough. But routine users ... not really much of a problem. Excepting the flailing efforts of a totally inexperienced sysadmin as cormander points out, but that's a different issue.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Protecting a Laptop? flamesrock Linux - Hardware 4 09-11-2005 10:08 PM
Protecting M$ from viruses? z9_87 General 10 08-12-2005 08:43 AM
Protecting data... Dee-ehn Linux - General 5 06-09-2005 04:41 PM
is slackware protecting me? shanenin Slackware 1 10-19-2003 09:28 AM
Protecting directorys antken Linux - Security 3 07-30-2002 09:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 09:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration