Automatically Mount a Drive when Linux Boots

If you want to have a drive (more specifically, a partition) mount when a GNU/Linux distro boots, simply add it to your /etc/fstab file. The fstab for Ubuntu usually looks like this: # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed.

Adding a user to sudoers file

“username is not in the sudoers file. This incident will be reported.” Aw. Well if you have root access, here’s how to add your user to the sudoers file. This will allow you to simply use sudo instead of su and logging in as root. su echo 'username ALL=(ALL) ALL' >> /etc/sudoers The first command will ask you for the root password. The second command adds username to the sudoers file.

Check a site for 404 errors with wget

No one wants broken links on their site. Here’s an easy way to check for 404 errors among the links on your website. First, you’ll want to run this wget command: wget -o ~/output.txt -r -l 10 --spider This will run wget recursively up to ten links deep. This means it finds each link on and tests if they exist, then checks each link on the pages it just tested up to a path of 10 pages from the original.

Alternatives to the Big VPS Companies

When it comes to renting a VPS, most people have heard of and use companies like Linode, Rackspace, Amazon, or Digital Ocean. These are great and they offer some pretty cool products. I used Amazon’s free offering for a bit (the Micro instance), and I’ve used Digital Ocean’s bottom two instances: 512MB Ram, 1 CPU, 20GB SSD for $5/month - and 1GB RAM, 1 CPU, 30GB SSD for $10/month. I thought this was great, a powerful VPS with 1GB of RAM for only $10/month!

Blocking IP Addresses with Nginx

Nginx is a powerful web server program. I have discussed before the growing popularity of nginx and how to get started with it. This post will build on that and show you how to block and allow specific IP addresses with nginx. Blocking IP addresses is useful when you want only certain people to access a website. I’m sure it’s not a complete block from a security standpoint (throw some kind of authentication in play if you want to be sure), but it works pretty well.

Create a passwordless ssh key

If you get tired of typing in a password when you connect to a remote machine with ssh, you can create an ssh key without a password to ease the process. Although this is not as secure as a key with a password, it is quicker. To create the key, type ssh-keygen This will create two keys, a private and a public key. Next you should copy the public key on the remote machine.

Confine SSH user to home directory with rbash

You can use rbash to limit a user to their own home directory (they cannot cd to other directories, or write to them). To do this, you will want to edit /etc/passwd and change the user’s shell: test:x:1001:1001:,,,:/home/test:/bin/bash should change to test:x:1001:1001:,,,:/home/test:/bin/rbash I did this on Ubuntu 12.04, so if your system varies from that then you might have additional steps.