Start a docker container to play with, then save it!

docker run --rm -t -i phusion/baseimage:0.9.11 /bin/bash I use the baseimage-docker distro from phusion…its quite nice…includes bash, runit, and a few other nice features that make it feel like a full featured install that will work properly with docker (i.e. docker stop works correctly) The “*–rm*” will remove the container after you leave it. This is generally preferred. We just launch bash in this example. You could make your own image and launch it with zsh or the like:)

Continue reading ↦

Finding a needle in a haystack: SQL with regex

So I run multiple pastebin services. One day, a friend needed a paste from weeks ago and so to the database I went (using stikked). I needed to search the paste content, known as column “*raw*” and pull out the record corresponding to the content (date, id, etc..). What’s awesome is you can use regex in all of your sql statements when searching anywhere in the db. So I just did this:

Continue reading ↦

Making ssh keys work: Permissions

Setting up ssh keys is effectively very easy. You throw your pubkey in its own line in your $HOME/.ssh/authorized_keys file. However, you may not know that it matters very much the permissions that the following files have set: home directory .ssh directory your authorized_keys file After doing this multiple times, here is the corresponding combination that works for me: 755, 750, or 700 (grp and other should have no write perms)

Continue reading ↦

Saving docker images without a registry

There is a pretty convienient way to save your docker images you build without needing to commit them to a registry: docker save mynewimage > /tmp/mynewimage.tar Then, to use it on a new host: docker load < /tmp/mynewimage.tar Thanks James!


Listing out your drives, the pretty way

Just found the command I’ve forever been looking for: goliath# blkid -o list device fs_type label mount point UUID -------------------------------------------------------------------------------------------------------- /dev/sda2 ext4 golvm /mnt/ssd2 158dac38-a368-4a37-983e-8e4b63cc838f /dev/sdd linux_raid_member goliath:1 (in use) 4c9df4da-6def-7a1b-f269-1137c0c49112 /dev/sdb1 ext4 / d288026a-a2d2-45c0-b848-3ac032909b33 /dev/md0 ext4 /mnt/raid 5193fa69-3c56-46cd-90bd-31036c931f5e /dev/sda1 ext4 /mnt/ssd1 bc2503ac-ad7a-4c70-8127-6ed37c96548f /dev/sdl1 ext4 /mnt/usb becc31d7-35ff-4145-876a-2520460ff532 /dev/sdi linux_raid_member goliath:1 (in use) 4c9df4da-6def-7a1b-f269-1137c0c49112 /dev/sdk linux_raid_member goliath:1 (in use) 4c9df4da-6def-7a1b-f269-1137c0c49112 /dev/sdh linux_raid_member goliath:1 (in use) 4c9df4da-6def-7a1b-f269-1137c0c49112 /dev/sdj linux_raid_member goliath:1 (in use) 4c9df4da-6def-7a1b-f269-1137c0c49112 /dev/sdf linux_raid_member (in use) c2e53423-5bc2-a1e6-fcbf-496432a662fa /dev/sdc1 ext4 /mnt/500dump 05fe6113-5433-45b1-9fb6-2346d94534b0 /dev/md1 jfs (not mounted) 9413d08a-fd5d-4f26-a876-198565f5e392 goliath#


Setting up a hard quota with a directory (on XFS)

So I needed to do per-directory hard quotas for my users. Luckily, xfs supports “project” quotas which allow a directory hierarchy to be soft or hard limited. To set this up for a user, lets call him derpface: Add the option “*pquota*” to fstab so the xfs partition gets mounted with project quotas enabled. Run the following commands to setup the project and directory declarations: mkdir /srv/derpface echo 1600:/srv/derpface >> /etc/projects echo derpface:1600 >> /etc/projid Note that the “1600?

Continue reading ↦

What happens when you bork sudo?

Made a change to sudo and fudged up the line where I give myself certain permissions… This caused a fun parse error that wouldn’t let me continue my “*sudo su*” Its ok though, just run: pkexec visudo type your pass, and you’ll be dumped into the sudoers file for fixing! Thanks, askubuntu!


NFS username mapping even with same uid

Ran into this with my internal testing boxes. Basically, I would mount a simple insecure uid/gid mapped share: /mnt 192.168.1.0/24(rw,all_squash,insecure,no_subtree_check,anonuid=1000,anongid=1000) on a testbox with a username different from the one of the server. But, the uid was the same (1000). With NFSv3, this would have been fine. With NFSv4, there are some differences. Hence things like ssh keys would not work because while I could remove and create new files, the files that existed there were still not technically mine?

Continue reading ↦