How to SSH to a VirtualBox from macOS

By: Kevin | January 17, 2017

On macOS (host):

Shutdown your VM and do:

  1. VirtualBox > Settings > Network > Add (you will get vboxnet0)
  2. Network:
  3. Mask:
  4. On a terminal ifconfig will show you new interface vboxnet0
  5. VM’s Settings > System > check “Enable I/O APIC.” VM’s Settings > Network > Adapter 2 > host-only vboxnet0

On Ubuntu 16.04.1 (guest):

Install OpenSSH Server, sudo apt-get install ssh

Run ip link, You should see a list like lo, enp0s3 and enp0s8 or something to that effect. Use that interface name for the below.

Edit /etc/network/interfaces file to append the following lines:

# The loopback network interface
auto loiface lo inet loopback
# The primary network interface
auto enp0s3
iface enp0s3 inet dhcp
# The static ip to ssh to
auto enp0s8
iface enp0s8 inet static

Run sudo ifup enp0s8 or sudo shutdown -r now from the Ubuntu command line. SSH server should be up and running.

Switch to your host terminal and enter ssh user@

How to Generate SSH/SSL Public and Private Keys

By: Kevin | December 6, 2016


  1. ssh-keygen -t rsa -b 2048 -f keyName
    Tap enter twice to skip the passphrase, or enter one if you like.
    This will output keyName and

SSL with self-signed Certificate Authority (CA)

  1. Create CA key without passphrase openssl genrsa -out rootCA.key 2048 add -des3 if you want a passphrase
  2. Self sign the CA, openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem. Now you have a self signed SSL named rootCA.pem


Use the CA just created to sign other SSL certificates.
  1. Create a private key, openssl genrsa -out device.key 2048
  2. Create a certificate signing request (CSR), openssl req -new -key device.key -out device.csr. Its important to note when answering the prompts, Common Name (eg, YOUR name) []: must match the host name of the web server you are using.
  3. Sign the CSR with your CA.openssl x509 -req -in device.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out device.crt -days 500 -sha256

Handy Linux commands

By: Kevin | August 22, 2016

Handy Commands to remember:


Recursively Change permissions

sudo find /var/log/test -type f -exec chmod 777 {} \;

sudo find /var/log/test -type d -exec chmod 777 {} \;


Search multiple files:

find . -name "*.log" | xargs grep -i <something>

grep -B x -A x file.log


Snapshot Date

date -u +%Y/%m/%d-%H:%M


Linux Permissions Cheat Sheet




4 read (r)

2 write (w)

1 execute (x)

7 = 4+2+1 (read/write/execute)

6 = 4+2 (read/write)

5 = 4+1 (read/execute)

4 = 4 (read)

3 = 2+1 (write/execute)

2 = 2 (write)

1 = 1 (execute)

Notes to self about WinRM

By: Kevin | August 22, 2016

Notes to self about WinRM.

On WinRs (client side) box, need to add ‘TrustHost’ to use CLI
winrm set winrm/config/client '@{TrustedHosts="machineA,machineB"}'

Trust all
winrm set winrm/config/client '@{TrustedHosts=“*”}’

List WinRm Listener IP and Port
Winrm enumerate winrm/config/listener
winrm e winrm/config/listener




Check running services

net start


Stopping and removing all Docker containers at once

By: Kevin | July 27, 2016

I found myself getting tired of copy and pasting UUID’s to remove containers one by one. I found this little snippet to help speed things up.

Stop all containers:
docker stop $(docker ps -a -q)

Remove all containers:
docker rm $(docker ps -a -q)


By: Kevin | July 2, 2016

Using brew on OS X,

To install:
brew install mysql

To start the server:
mysql.server start

To stop the server:
mysql.server stop

How to add or edit cronjobs

By: Kevin | June 27, 2016

Note to self:

Perhaps use sudo.

To list jobs:

crontab -l


To edit jobs:

crontab -e

How to prepare SD card for RASPBIAN JESSIE from Mac OS X

By: Kevin | December 28, 2015

I recently purchased a Raspberry Pi 2. I needed to put the OS on the SD card I had gotten. I don’t want to forget how I did this, so I’m writing it down.

  1. Download the OS image from Raspberry Pi site.
  2. Open terminal and go to the file and run: openssl sha1 /path/to/
  3. Make sure the sha1 matches whats on the download site to confirm file isn’t corrupted.
  4. Open Disk Utility on your Mac and format your SD card, I used FAT32
  5. In terminal, find your SD card by running: diskutil list
  6. Once you know what disk is your SD card unmount all partitions with: sudo diskutil unmount /dev/disk2s1 (Repeat as needed for all partitions)
  7. Unzip the Raspbian file by double clicking it, it should unzip a .img file.
  8. Lastly copy the image to the SD card by running: sudo dd bs=1m if=/path/of/img/file.img of=/dev/desk2 (Whatever disk it is. There is no progress bar so depending on your hardware this can take some time. Be patient.)

Add SSH key to OS X Keychain

By: Kevin | August 26, 2015

When you need to create an SSH key just run:

ssh-keygen -t rsa -b 2048 -f keyName

Enter your passphrase to generate your key. Then, add that private key to your OS X keychain for easy use by running:

ssh-add -K /path/of/private/key

This way when you ssh your private key will be presented for you on your MacBook and you’ll be all set!


How to upgrade Plex Media Server on Ubuntu

By: Kevin | March 30, 2015

Almost every time I need to upgrade my Plex Media Server I always forget the command and end up consulting the Google. So this post is for me,.. and hopefully help someone thats in the same boat as me.

  1. Go to
  2. Click on downloads -> Computer -> Linux
  3. I’m using Ubuntu on an old machine so I right click on 32-bit and copy link
  4. On your Ubuntu box paste the download link like so, wget This will download the update.
  5. Next run sudo dpkg -i plexmediaserver_WHATEVER-VERSION_i386.deb to install the update.
  6. Easy peasy, your done.

I like to reboot the machine after updating, just for good measure.




Next Page »