Archive for the 'General' Category

SBDavid

Extracting the MBR

Extracting the MBR

To see the contents of your MBR, use this command:

# dd if=/dev/hda of=mbr.bin bs=512 count=1
# od -xa mbr.bin

The dd command, which needs to be run from root, reads the first 512 bytes from /dev/hda (the first Integrated Drive Electronics, or IDE drive) and writes them to the mbr.bin file. The od command prints the binary file in hex and ASCII formats.

SBDavid

How to encrypt file with passphrase

How to encrypt file with passphrase

Mcrypt is a simple crypting program, a replacement for the old unix crypt(1). When encrypting or ecrypting a file, a new file is created with the extension .nc and mode 0600. The new file keeps the modification date of the original. The original file may be deleted by specifying the -u parameter. If no files are specified, the standard input is encrypted to the standard output.

$ mcrypt -uz file1

Enter the passphrase (maximum of 512 characters)
Please use a combination of upper and lower case letters and numbers.
Enter passphrase:
Enter passphrase:
File file1 was encrypted.

-d, –decrypt decrypts.
-z, –gzip Use gzip to compress files before encryption.
-u, –unlink Unlink the input file after encryption or decryption.

Unpacking and configuring kvm components

Prerequisites

*kvm-release.tar.gz
*A VT capable Intel processor, or an SVM capable AMD processor

qemu prerequisites:

`zlib` libraries and headers
`SDL` libraries and headers
`alsa` libraries and headers (optional alsa support: disabled by default but can be enabled with –enable-alsa)
`gnutls` libraries and headers (optional VNC TLS support: enabled by default but can be disabled with –disable-vnc-tls)
kernel headers (on Fedora, the kernel-devel package)

On a debian etch system you can install the prerequisites with:

apt-get install gcc libsdl1.2-dev zlib1g-dev libasound2-dev linux-kernel-headers pkg-config libgnutls-dev

If you’re not running a patched kernel:

tar xzf kvm-release.tar.gz
cd kvm-release
./configure –prefix=/usr/local/kvm
make
sudo make install
sudo /sbin/modprobe kvm-intel
# or: sudo /sbin/modprobe kvm-amd

Downloads

http://www.linux-kvm.org/page/Downloads

How to use kvm with a non-privileged user?

The cleanest way is probably to create a group, say kvm, and add the user(s) to that group. Then you will need change /dev/kvm to owned by group kvm.

On a system that runs udev, you will probably need to add the following line somewhere in your udev configuration so it will automatically give the right group to the newly created device (i-e for ubuntu add a line to /etc/udev/rules.d/40-permissions.rules).

KERNEL==”kvm”, GROUP=”kvm”

How can I tell if I have Intel VT or AMD-V?

With a recent enough Linux kernel, run the command:

egrep ‘^flags.*(vmx|svm)’ /proc/cpuinfo

If something shows up, you have VT. You can also check the processor model name (in `/proc/cpuinfo`) in the vendor’s web site.

/proc/cpuinfo only shows virtualization capabilities starting with Linux 2.6.15 (Intel) and Linux 2.6.16 (AMD). Use the `uname -r` command to query your kernel version.

« Prev - Next »