Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

nevada

« Newer Snippets
Older Snippets »
Showing 1-10 of 31 total  RSS 

create linux bootdisk and fix grub after windows reinstall

Boot Disk Method
1. Create boot disk.
For Fedora Core 3:
/sbin/grub-install /dev/fd0

For Fedora Core 4+:
mkbootdisk `uname -r`

2. Reinstall Windows.
3. boot with floppy then
grub-install /dev/hdb


Rescue CD
1. Boot using FC3 CD then
linux rescue
chroot /mnt/sysimage
grub-install /dev/hdb


http://www.fedoraforum.org/forum/showthread.php?t=1272

encrypt data with openssl

Encrypt:
openssl des3 -salt -in unencrypted-data.tar -out encrypted-data.tar.des3
enter des-ede3-cbc encryption password:
Verifying - enter des-ede3-cbc encryption password:


That command will encrypt the unencrypted-data.tar file with the password you choose and output the result to encrypted-data.tar.des3. To unlock the encrypted file, use the following command:

Decrypt:
$ openssl des3 -d -salt -in encrypted-data.tar.des3 -out unencrypted-data.tar
enter des-ede3-cbc encryption password:

logging sessions in linux

* Stores the complete console session including colour.

Start: script <logfile>
Stop: Ctrl+D
See: cat <logfile> or more <logfile>

ftp recipes

Recursively Transfer all files in certain directory
ncftpget -u <username> -p <password> -R ftp://ftp.microsoft.com/Files/

Install App From Source

1. tar xvzf filename-version.tar.gz
2. cd filename-version
3. ./configure && make && make install
4. Note you have to be root for the make install step if you are installing into system wide directories. You can always install to your home directory, of course.

Mouting Directories for vsftp

mount --rbind /mnt/pub /home/pub

* logs are located at /var/log/vsftpd.log and /var/log/xferlog

ssh and scp without typing a password each time

* You can create and exchange ssh keys to avoid repeatedly typing your password.

Source: ssh-keygen -t dsa Type this once per log-in session
Source: Now copy the .ssh/id_dsa.pub file to <Destination>.
Source: scp .ssh/id_dsa.pub userid@<Destination>:tempid we've renamed it tempid.
Destination: cat tempid >> .ssh/authorized_keys
add the contents of tempid to .ssh/authorized_keys.
Destination: rm tempid.

Mounting iso/bin/cue

* Method 1: Use CDEmu.
cdemu 0 pro.cue

mount -t iso9660 /dev/cdemu/0 /mnt/temp

* Method 2: Convert to ISO.
Convert BIN/CUE to ISO:
bchunk -v acrobat6pro.bin pro.cue pro

* Just mount the ISO by executing as root.
mount -o loop,ro -t iso9660 <filename>.iso <mountpoint>

mount -o loop pro01.iso /mnt/temp


building source rpm

*
rpmbuild --rebuild *.src.rpm

* New rpm files in the /usr/src/redhat/RPMS/<arch>
* use rpm -Uvh to install them

setup computer hostname in linux

* edit
/etc/sysconfig/network

* add the following lines:

HOSTNAME=www.test.com
DOMAINNAME=test.com

« Newer Snippets
Older Snippets »
Showing 1-10 of 31 total  RSS