Tips of hardware, software, OS, programming languages, Windows, XP, Vista, Linux, Macintosh,OSX86, Ubuntu , Hacking tools , Tips and Tricks for Hacks
Friday, December 3, 2010
Red Hat Tips and Tricks
1) Wiping a hard Drive
Have you ever needed to completely wipe out critical data from a hard drive? As we all know, mkfs doesn’t
erase a lot. (You already knew this, right?) mkfs and its variants (e.g., mkfs.ext3 and mke2fs) only get rid of a few important data structures on the filesystem, but the data is still there! For a SCSI disk connected as /dev/sdb, a quick
dd if=/dev/sdb | strings
will let anyone recover text data from a supposedly erased hard drive. Binary data is more complicated to
retrieve, but the same basic principle applies: the data was not completely erased. To make things harder for the bad guys, an old trick was to use the ‘dd’ command as a way to erase a drive.
Note: This command will erase your disk!
dd if=/dev/zero of=/dev/sdb
There’s one problem with this: newer, more advanced, techniques make it possible to retrieve data that were
replaced with a bunch of 0s. To make it more difficult, if not impossible, for the bad guys to read data that was previously stored on a disk, Red Hat ships the “shred” utility as part of the coreutils RPM package. Launching “shred” on a disk or a partition will write repeatedly (25 times by default) to all locations on the disk.
Note: Be careful with this one too!
shred /dev/sdb
This is currently known to be a very safe way to delete data from a hard drive
2) USB when the Drivers not available
As a way to save a few valuable pennies on newer PCs, manufacturers are increasingly getting rid of the good old PS/2 keyboard and mouse interfaces. As a result, some recent systems only ship with USB ports to which we need to connect a USB keyboard and mouse. USB is all well and good, but what if the driver for your USB controller is not loaded? In practice, this is not a problem, as Red Hat loads the ehci- hcd and uhci-hcd drivers automatically at boot time. There are situations, namely in emergency mode, where the USB drivers won't be available. So you won't even be able to enter a command. This is due to the fact that in emergency mode all drivers need to be provided in the initrd file under /boot, and USB is not there by default. The trick is to add those drivers, so that they will be available earlier. The 'mkinitrd' command can do precisely that with the '--with' argument (this only works under RHEL4):
mkinitrd --with=ehci-hcd --with=uhci-hcd /boot/newinitrd-`uname -
r`.img
`uname -r`
Add a new entry in your grub.conf file (always do backups!) that points to this new initrd image, and you're
done! Your USB keyboard now works in emergency mode.
Labels:
Linux,
Tips and Tricks
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment