Posts | Tags | Archive

Backing up data to an external server via SSH

I recently needed to back up the contents of a website, but found that a disk quota was preventing me from doing so. What I really needed to do was find a way to compress all the files and, instead of storing the archive locally, pipe the output to another server.

After much Googling and messing about, I ended up with the following command:

1
2
3
#Uses the tar utility to backup files to an external server

tar zcvf - /path/to/backup | ssh user@server:port dd of="filename.tgz" obs=1024

Of course, this is only practical for a one-off data dump. If regular backups were needed, using rsync would be the best option, as it only transfers incremental changes. An excellent tutorial can be found here.


How to set up Queen's University Webmail on an iPhone

Before you start, make sure the iPhone is connected to the internet via 3G or WiFi.

  1. Navigate to the main settings screen
  2. Tap "Mail, Contacts, Calendars"
  3. Tap "Add Account..."
  4. Tap "Other"
  5. Tap "Add Mail Account"
  6. Enter your name, the address of the account you want to access ([your NetID]@queensu.ca), your password, and an optional description
  7. Tap "Save"
  8. Tap "IMAP"
  9. Scroll down to "Incoming Mail Server" and enter the following info:
    • Host Name: mail.queensu.ca
    • User Name: [your NetID]
    • Password: [your password]
  10. Scroll down to "Outgoing Mail Server" and enter the following info:
    • Host Name: mail.queensu.ca:465
    • User Name: [your NetID]
    • Password: [your password]
  11. Save and exit.

Good Luck!


Setting up TortiseHg on Windows

TortiseHg can be a bit of a pain to set up if you don't want to haveĀ peagent running in the background all the time for authentication. This method uses TortisePlink (comes with the install) for authentication, and runs it only when it needs to authenticate.

Generating a public/private key pair

  1. Download PuTTYgen and run it.
  2. Generate the key pair by clicking the generate button.
  3. Optionally, enter a passphrase to protect the private key.
  4. Save the public and private keys somewhere. I prefer to save them as id_rsa.pub and id_rsa.ppk in C:/Users/[username]/.ssh/ but it doesn't really matter.

Setting up TortiseHg

  1. Download TortiseHg and install it.
  2. When installing, make sure that SSH Utils are installed.
  3. When it finishes installing, run the program (it'll be called "TortiseHg Workbench" in the start menu).
  4. Configure the settings as you see fit. This will generate a configuration file at C:/Users/[username]/mercurial.ini.
  5. Close the program and open up mercurial.ini in a text editor.
  6. Under the "[ui]" section (if it doesn't exist, create it) add/edit two entries (adjusting for your own custom settings):
1
2
username = [name] <[email]@[domain]>
ssh = "C:\\Program Files\\TortoiseHg\\TortoisePlink.exe" -i "C:\\Users\\[username]\\.ssh\\id_rsa.ppk"

Now all that's needed is to upload the generated public key to the server(s) you wish to pull from or push to.

When asked, just open the key up in a text editor (make sure it's the public key, NEVER share your private key) and copy-paste the text.

After configuring this, you'll be able to push to repositories on the servers you give your public key to, without having to enter your password every time.

© Carey Metcalfe. Built using Pelican. Theme is subtle by Carey Metcalfe. Based on svbhack by Giulio Fidente.