Saturday, February 23, 2013

SSH Config files, and repo installs

In your .ssh folder, make a file called "config", put in it this information, change to your specs.

Host example.com
  Hostname example.com
  HostKeyAlias example
  Port 2222
  User linus






This is handy to have when you ssh into machines that have non standard ports, so with this you can now type: "ssh example" and it will insert your information that's needed for logging in. You still need the password, unless you setup keys. It works for scp as well. This is what I use it for.




Also today created a quick script for my rhel machines.


http://www.simontek.net/linux/iso/repoinstall.sh

# Created by Matthew M. Conley to add the epel, and el repo's to a build.
#
#!/bin/bash
if grep --quiet "[elrepo]" /etc/yum.repos.d/*; then
   echo "EL repo is installed"
else

rpm --import http://elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
fi

if grep --quiet "[epel]" /etc/yum.repos.d/*; then
   echo "epel is installed"
else
rpm --import https://fedoraproject.org/keys
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
fi

 It checks to see if the el and epel repo's are installed, if not installs them. I tend to have to do this all the time, so figured just put it in a script. I still can't tell you how often on test builds that I didn't use a kickstart I have to type "sed -i 's/no/yes/' /etc/sysconfig/network-scripts/ifcfg-eth0" Which turns the ONBOOT=no to ONBOOT=yes in eth0 config file.

Saturday, February 16, 2013

LUKS unlock

So, I went to manually unlock a LVM partition, and realized I had to look it up. It took me a few pages, so I am just copying the notes, cause I will have to do this again.
I was not using a debian or fedora based system, but its handy.

cryptsetup luksOpen /dev/ 
Enter any LUKS passphrase: 
key slot 0 unlocked.
Command successful.



  1. $ sudo apt-get install lvm2
    
  2. Load the necessary module(s):
    $ sudo modprobe dm-mod
    
  3. Scan your system for LVM volumes and identify in the output the volume group name that has your Fedora volume (mine proved to be VolGroup00):
    $ sudo vgscan
    
  4. Activate the volume:
    $ sudo vgchange -ay VolGroup00
    
  5. Find the logical volume that has your Fedora root filesystem (mine proved to be LogVol00):
    $ sudo lvs
    
  6. Create a mount point for that volume:
    $ sudo mkdir /mnt/fcroot
    
  7. Mount it:
    $ sudo mount /dev/VolGroup00/LogVol00 /mnt/fcroot -o ro,user
    
  8. Copied my files.