mount: could not find any free loop device



You can see what is being used by a loop device with losetup:

  # losetup /dev/loop0
  /dev/loop0: [fd06]:234921356 (/linux/isos/backtrack.iso)

It is possible to increase the number of available loop devices. Free
all loop devices, and add a line with the following to
/etc/modprobe.conf:

     options loop max_loop=64

(maximum is 256)

Then, do:  
     rmmod loop && modprobe loop

If you get an error that the module couldn't be removed, you still have loop 
devices in use.

Newer kernels (2.6.21 or 2.6.22) use a dynamic allocation of loop devices, 
so you will only have to create the filesystem representation of the devices:

  for ((i=8;i<64;i++)); do
    [ -e /dev/loop$i ] || mknod -m 0600 /dev/loop$i b 7 $i
  done

Happy Pi Day!


And don’t forget 6:28pm (Tau Time)!

Future Holidays to look forward to:
  • March 14, 2015 = Pi Day (to 4 decimal places)
  • April 4, 2016 = Square Root Day
  • 6:02am on October 23, 2012 = Mole Day (6:02 10/23)

Swap Your Laptop for an iPad + Linode

Here's an excellent Linux Journal Article which talks about using an iPad with a Bluetooth keyboard, to ssh into a Linux host:

The Linux host is a virtualized node in "the cloud":

And the SSH client for iPad can be found here:
iSSH for iPad app: http://itunes.apple.com/us/app/issh-ssh-vnc-console/id287765826?mt=8


I've tried this app on my iPad and I think this works a lot better than I thought it would!

IT Certification Master

I found a new site with lots of IT Certification infomation. It's new, but it looks like a really good start. Check it out here: http://www.itcertificationmaster.com/


Scripting: Is today the last day of the month?


Here's an easy way to check. Very useful when scripting an action (like a backup for example) that needs to happen on the last day of the month.
[ `date --date='next day' +'%B'` == `date +'%B'` ] || echo 'end of month' && echo 'not end of month'

Does MCSA equate to MCITP: Server Administrator and does MCSE equate to MCITP: Enterprise Administrator?


A.
No, not exactly. The MCITP on Windows Server 2008 certification requires a new skill set—in some cases, a more robust one—that differs from the skill set needed for MCSA and MCSE certifications.
  • MCITP: Server Administrator certification covers more operations-related job skills than the MCSA certification.
  • MCITP: Enterprise Administrator maps to an actual job role profile, whereas the MCSE certification does not. The latter combines technology and job skills.

How do I get RHN Satellite Server on RHEL6.2 to authenticate to MS Active Directory on a host with Centrify installed?

My Server has:

Red Hat Enterprise Linux Server 6.2
Red Hat Network Satellite Server 5.4.1
CentrifyDC 5.0.1-177

1. Edit the rhn.conf file:

echo "pam_auth_service = password-auth" >> /etc/rhn/rhn.conf

2. Restart the Satellite Server:   

/usr/sbin/rhn-satellite restart

3. Login to your RHN Satellite web gui

4. Create a new user, as in the following example:
 
Go to "Users" tab -> "Create New User" -> 

Desired Login*:  centrifyuserid
Desired Password *:  Keep Blank 
Confirm Password *:  Keep Blank
Pluggable Authentication Modules (PAM):  Enable Checkbox 

Pass Firstname , Lastname & email -> click on "Create Login" 
 
Your user should now be able to login with their AD credentials.
You will still need to specify what permissions they have in 
RHN Satellite.
 

Migrating from RHEL6 to CentOS6...

Why would anyone ever want to do this???
mkdir TMP
yum remove rhnlib abrt-plugin-bugzilla redhat-release-notes*
rpm -e --nodeps redhat-release redhat-indexhtml
cd TMP
wget http://mirror.centos.org/centos/6/os/x86_64/Pack\
ages/centos-release-6-0.el6.centos.5.x86_64.rpm
wget http://mirror.centos.org/centos/6/os/x86_64/Pack\
ages/centos-indexhtml-6-1.el6.centos.noarch.rpm
wget http://mirror.centos.org/centos/6/os/x86_64/Pack\
ages/yum-3.2.27-14.el6.centos.noarch.rpm
wget http://mirror.centos.org/centos/6/os/x86_64/Pack\
ages/yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm
rpm -Uvh *.rpm
cd ..
rm -rf TMP
yum clean all
yum upgrade

How to Migrate from RHEL5 to CentOS5...


# cp /etc/redhat-release /etc/redhat-release-saved
# rpm -e --nodeps redhat-release-notes redhat-release \
yum-rhn-plugin redhat-logos
# rpm -ivh \
http://mirror.centos.org/centos/5/os/i386/\
CentOS/centos-release-5-5.el5.centos.1.i386.rpm  \
http://mirror.centos.org/centos/5/os/i386/\
CentOS/centos-release-notes-5.5-0.i386.rpm \
http://mirror.centos.org/centos/5/os/i386/\
CentOS/redhat-logos-4.9.99-11.el5.centos.noarch.rpm
# yum update

How to make a RHEL Auto-Install DVD

This is how I make a bootable Red Hat Enterprise Linux installation DVD, that includes a customized kickstart file. Installation is automatic and no questions are asked. 
Make a directory called ./dvd/

Loop mount the ISO image of the DVD and copy all of its contents (intact) to ./dvd/

Unmount the ISO image.

The kickstart file is named ks.cfg and is placed in the root directory of the DVD.

In the ks.cfg file:

install
cdrom          
poweroff       

This specifies cdrom as the installation source and causes the machine to power off when done installing, so we can remove the DVD from the drive.

In the isolinux/isolinux.cfg file:

default linux    
prompt 1
timeout 6        
display boot.msg
label linux
  kernel vmlinuz
  append initrd=initrd.img method=cdrom ks=cdrom:/ks.cfg   

Change the timeout to something quicker. The default statement specifies which menu option is selected automatically. In the menu option, we specify cdrom as the installation method, and the location and name of the kickstart file (which has to be named ks.cfg).

Create the new ISO file from the contents of the ./dvd/ directory:

/usr/bin/mkisofs -o dvd.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T ./dvd/

The -o option lets you name the ISO image file anything you want. 
Copy the resulting dvd.iso file to your PC and burn it to a DVD.

How to create an SSH tunnel for vncviewer

What I'm doing is using a vncviewer to connect to a vncserver, via an intermediary host (such as a firewall), using a SSH Tunnel between HostA and HostC, to encrypt communications.

I have the same unprivileged userid on all three hosts. Also, I used ssh keys for authentication, just to speed things up. Otherwise, you can specify username@host and enter the password when asked.

$ ssh -N -T -X -f HostB.example.com -L 5905:HostC.example.com:5905 --sleep +30m
$ vncviewer localhost:5905 &

Change the “+30m” to however long you want the ssh tunnel to stay open. You can also use “+8h” or “+1d”.

+----------+        +----------------+        +-------------+
| Host A   |        |                |        |   Host C    |
|          |------->|  Host B        |------->| destination |
| vncviewer|        | "intermediary" |        | vncserver   |
+----------+        +----------------+        +-------------+

gpg cheat sheet

The GNU Privacy Guard (GnuPG or GPG) is a free software alternative for the PGP suite
of cryptographic software, released under the GNU General Public License. It is an
essential tool to encrypt data or communications.

Create a key

  gpg --gen-key

Export keys

  gpg --export -a "User Name" > public.key
  gpg --export-secret-key -a "User Name" > private.key

Import keys and give trust

  gpg --import public.key
  gpg --import private.key
  gpg --edit "User Name"
  >trust
  (select the 'trust ultimately' option)
  >q

List and delete

  gpg --delete-secret-key "User Name"
  gpg --delete-key "User Name" #corresponding private first
  gpg --list-keys
  gpg --list-secret-keys

Encrypt

  gpg -e [-u "Sender"] [-r "Receiver"] somefile

     - creates somefile.gpg, does not delete somefile
     - Use yourself as receiver for private data

Decrypt

  gpg -d mydata.tar.gpg

MCITS: Enterprise Administrator Certification


For those of you who are seeking certification, Microsoft Press has just released a Second Edition of their “Blue Training Books” as show below. These books cover all the changes that came with Windows Server 2008 R2. The certification tests have already been updated for R2, so previous versions of these books are now obsolete. In addition to the four tests mentioned below, you will also need MS 70-680 (Configuring Windows 7) to complete the requirements for the MCITS: Enterprise Administrator certification, which is the equivalent to the older MCSE Certification.
I have had success using these books for study when preparing for these tests, but your results may not be the same. I recommend these books only to those who have already found success with this method of study.
Finally, if you need the software, you can download Windows Server 2008 R2 with Service Pack One 180-Day Trial from here: http://technet.microsoft.com/en-us/evalcenter/dd459137 (registration required).


MCITP Windows Server® 2008 Enterprise Administrator: Training Kit 4-Pack: 
Exams 70-640, 70-642, 70-643, 70-647, Second Edition
Available from: Amazon.com, Barnes & Noble, O’Reilly or your favorite online reseller.
Dan Holme, Nelson Ruest, Danielle Ruest, Tony Northrup, J.C. Mackin, Anil Desai, Orin Thomas, John Policelli, Ian L. McLean, Paul Mancuso, David R. Miller, Jason Kellington
Get in-depth preparation for MCITP: Enterprise Administrator Exams 70-640, 70-642, 70-643, and 70-647—as you build real-world job skills. Get study guides, 1200+ practice questions, reviews, labs, and an exam discount.
Your all-in-one kit includes:
  • Official self-paced study guides for four required exams
  • 1,045+ practice and review questions
  • Practice tests with multiple, customizable testing options and a learning plan based on your results
  • Case scenarios, exercises, and best practices
  • 15% exam discount from Microsoft; good for four exams. Offer expires 12/31/15.
  • Fully searchable eBooks for all four study guides
Product Details
·         Paperback: 3808 pages
·         Publisher: Microsoft Press; Second Edition (October 3, 2011)
·         Language: English
·         ISBN-10: 0735663270
·         ISBN-13: 978-0735663275
·         Product Dimensions: 9 x 7.8 x 6.1 inches
·         Shipping Weight: 10.6 pounds
NOTE: Additionally, you will need to take and pass MCTS Self-Paced Training Kit (Exam 70-680): Configuring Windows® 7 to complete the requirements for MCITS: Enterprise Administrator, which is the Windows Server 2008 equivalent to the old MCSE certification.
Product Details
  • Hardcover: 880 pages
  • Publisher: Microsoft Press; 1 Har/Dvdr edition (October 21, 2009)
  • Language: English
  • ISBN-10: 0735627088
  • ISBN-13: 978-0735627086
  • Product Dimensions: 9 x 7.4 x 1.8 inches
  • Shipping Weight: 3.3 pounds

How to create a LUKS LVM Partition

  1. Create a logical volume: lvcreate -L 500M -n crypto cryptovg
  2. Fill the logical volume with random data: dd if=/dev/urandom of=/dev/cryptovg/crypto
  3. Initialize the logical volume: cryptsetup --verbose --verify-passphrase luksFormat /dev/cryptovg/crypto
  4. Open the newly encrypted device: cryptsetup luksOpen /dev/cryptovg/crypto cryptosec
  5. Check that it’s there: ls -l /dev/mapper | grep cryptosec
  6. Create a filesystem: mkfs.ext4 /dev/mapper/cryptosec
  7. Mount it: mount /dev/mapper/cryptosec /media/cryptosec
  8. Check that it’s visible: df -h | grep cryptosec
  9. Add the following to /etc/crypttab: cryptosec /dev/cryptovg/crypto none
  10. Edit your /etc/fstab, removing the old entry for /dev/cryptovg/crypto and adding /dev/mapper/cryptosec /media/cryptosec ext4 defaults 1 2
  11. Restore default SELinux security contexts: /sbin/restorecon -v -R /media/cryptosec
  12. Reboot: shutdown -r now
  13. The entry in /etc/crypttab makes your computer ask your luks passphrase on boot. Enter your password when asked. Login as root and restore your backup.