Convert a pem file into a rsa private key

When you build a server in AWS one of the last steps is to either acknowledge that you have access to an existing pem file, or to create a new one to use when authenticating to your ec2 server.

If you want to convert that file into an rsa key that you can use in an ssh config file, you can use this handy dandy openssl command string.

openssl rsa -in somefile.pem -out id_rsa

Note: you don’t have to call the output file id_rsa, you will want to make sure that you don’t overwrite an existing id_rsa file.

Copy the id_rsa file to your .ssh directory and make sure to change permissions on the id_rsa key to read only for just your user.

chmod 400 ~/.ssh/id_rsa

Working with logical volumes (part 2)

In this post I want to cover one of the most commonly used features of lvm, extending a logical volume. If you were following along with the last post, “Working with logical volumes part 1”, then you should already have a volume group with a couple of live volumes attached.

With lvm you can quickly and easily extend a Linux file system on the fly without interrupting any services.

Continue reading “Working with logical volumes (part 2)”

Working with logical volumes (part 1)

Part one of working with logical volumes will cover the basic’s involved in creating logical volumes.

TL;DR

For those of you who just want the order of the commands.

sudo pvcreate </path/to/device>
sudo vgcreate <vgname> </path/to/device>
sudo lvcreate -n <lvname> -L <size> <vgname>
sudo mkfs.<filesystem> </path/to/lv>

What you need to follow this guide

  • A free disk (I used an empty virtual machine disk)
  • Any Linux distribution (In this example I’ll be using Fedora 26, but the commands are the same across the entire Linux spectrum)
  • LVM packages (lvm2 – usually pre-installed)

What is LVM?

Logical Volume Management (LVM) offers a way to abstract a disk, multiple disks, or disk partitions into one logical volume. LVM filesystems can be rearranged, resized, moved, removed, created, and deleted on the fly. They offer incredible flexibility when setting up a new system or when rethinking the storage layout of an existing system.

Logical Volume Management filesystems are made up of 4 major parts

Continue reading “Working with logical volumes (part 1)”

Open multiple files with vim

There are many instances when it’s useful to have multiple files open in vim, but if you aren’t familiar with this tool you can find yourself needlessly jumping around between multiple windows. If you are doing any type of real systems work on a Linux operating system I suggest that you familiarize yourself with vim. If you are not already using vim start by opening a command prompt and type vimtutor, once you’ve become familiar with how to navigate, search, and edit a document with vim this post will make more sense to you.

Use vim to see what is different between two files

There are several ways to find differences between two files on a Linux server or desktop. I like to use vim when I’m scanning a configuration file for recent changes from an earlier iteration ( assuming of course that there is a backup of the last known, good, configuration).

Comparing two files is a common task and there are several ways to view the differences between multiple files, but occasionally you may want to do this visually side by side.

Continue reading “Open multiple files with vim”

How to RTFM (Read the *#&@ Manual)

Finding help with Linux

If you hang out in enough Linux forums asking questions sooner or later someone will tell you to read the manual (presumably they think this will help you). Fortunately, over the last few years “rtfm” has ceased being the default answer to questions from new users. All things considered the Linux world has become more user friendly, even if the man pages haven’t.

One of the things that will allow you to separate yourself from new and even some intermediate users is knowing where to find the help you need on your own, knowing how to read the information you find, and then being able to apply that information. Plus, if you plan to take any Linux exams you will need to know how to find and read man pages. There is simply no way that most of us can memorize all of the command and configuration options you need to pass a Red Hat or Linux Foundation exam.

Continue reading “How to RTFM (Read the *#&@ Manual)”