Setting up SSH host shortnames

Here’s an example setup to create SSH host shortnames. On you local computer, add the following to ~/.ssh/config:

Host server1
HostName server1.internet.com
User david

Host server2
HostName server2.internet.com
User david

Host *
User davidwinter

Now with this file saved, you can ssh into server2.internet.com with just the following command:

ssh server2

This will save you having to type out:

ssh david@server2.internet.com

And if you have public key authentication setup, it makes the process even smoother. Adding the wildcard host record at the bottom allows you to specify a default username to use for other servers to the ones you’ve not specified above.

2010-08-22 [, , , , , ]
View Comments

SSH and public key authentication

Fed up with having to type your password in each time you log into a server over SSH? Me too. Down with passwords, and in with public key authentication!

(more…)

Avoid giving 777 permissions

Just a quick post for me to remember the following workflow of commands:

sudo find . -type d -exec chmod 755 {} \;
sudo find . -type f -exec chmod 644 {} \;
sudo chgrp -R www-data .
sudo chmod -R g+w .
2010-06-28 [, , ]
View Comments

Remove startup scripts on Ubuntu

sudo update-rc.d -f script_name remove
2009-10-20 [, , ]
View Comments

Merge video files with mencoder

To merge video files together with mencoder is simple:

mencoder -oac copy -ovc copy file1.avi file2.avi file3.avi -o full_movie.avi

Graphviz–for drawing directed graphs

This semester at University, I’m taking ‘Compiler Design & Techniques’ as a module. The second coursework involves drawing Finite State Machines diagrams that represent regular expressions. Rather than using a word processor to draw these diagrams with a rather untidy look about them, I went in search of a tool that’d help me produce high quality drawings. I’d heard that Latex was good for mathematical diagrams, but that seemed like overkill as I only wanted the diagrams, not a whole new document syntax to learn.

(more…)

2007-03-14 [, , , , ]
View Comments

Unix Disk Usage

A very handy command to see the total size of a directory on a Unix-based computer.

du -sh *

This will show the total size of files and directories in your current working directory. The s flag means to show a summary–which basically just shows the top level directory only, instead of the contents of each and every folder down the file system hierarchy. The h flag shows a human readable file size.

For my home directory, I get the following output:

404M    Desktop
 30G    Documents
6.0G    Library
 32G    Movies
 18G    Music
 11G    Pictures
2.7G    Projects
 16K    Public
166M    Sites