Archive | January, 2010

Configuring private keys for ssh access

(On Mac OS X) – This assumes you have already downloaded your priviate keys to your desktop

There are 2 keys, one private and one public (this one has a .pub extension). Using Terminal, move your downloaded keys to your .ssh folder: for each file, type

mv Desktop/{name of key file} ~/.ssh/

Give your keys the proper names:


cd ~/.ssh/
mv {name of private key} id_rsa
mv {name of public key} id_rsa.pub

The private key should have readonly permissions:

chmod 400 ~/.ssh/id_rsa

So now you can login to the server. To simplify the process, you also create a text file ~/.ssh/config , where you can set three lines for ssh login info for your simple ssh use. To create the file, type:

vim ~/.ssh/config

Press ‘I’ (capital i) to go into ‘edit mode’, and then the following 3 lines (using the example of our Vasudeva Server servers:)

Host {server-name}.vasudevaserver.net
Port {port-number}
User {user-name}

Where {server-name} is the name of our server in lower case, {port-number} is the port we use to connect (for security reasons this is very often changed from the default port 22) and {user-name} is your user name to access the server. When you are finished, press escape (to exit edit mode) and then ‘ZZ’ (to exit and save changes)

After you have done that, you can try to log in using the command

ssh {server-name}.vasudevaserver.net

Another tip…

You can also create a simple alias for the server name by adding a line to your /etc/hosts file

{server-ip} {server-name} {server-name}.vasudevaserver.net

So a example for a hypothetical server antara.vasudevaserver.net located at ip address 127.0.0.1 would be

127.0.0.1 antara antara.vasudevaserver.net

This means that when accessing our servers, you can simply type

ssh {server-name}

without the vasudevaserver.net at the end.

Comments { 0 }

Using git to develop sites (developers only)

We have recently moved our Drupal and WordPress repositories to git. We will also be putting our databases and static site filesystems there too, so we can generate test sites locally with a simple script. Here’s how to get started with developing sites:

Installing and configuring Git

  • Mac OS X: Go to download page and download the latest version.
  • On Windows: Go to download page and download Git-{version}-preview{release date}.exe

To configure git, there are some nice instructions here…

(VS Users: Aparajita has supplied in ticket SYSADM-610 to configure your git install: just download it, use Terminal to go to the directory where the script is, and type sh git_setup.sh. You will be asked for full name and email address.)

Using git

To create a version of the Drupal or wordpress repository on your local site, create a directory. Open Terminal, go to that directory and use:

git clone git@{servername}.vasudevaserver.net:drupal.git
or
git clone git@{servername}.vasudevaserver.net:wordpress.git

This will put the contents of the repository in that folder. Note: If the repository uses gitolite to control access via ssh, you must have the appropriate ssh keys on your machine to do this. In addition, you need to have these lines in your .ssh/config file


host gitolite
user git
hostname {server}.vasudevaserver.net
port {port_name}

To make changes to the repository, you have a few options:

  • Use the command line :)
  • There is a git client called SmartGit which is free for non-commercial purposes. We are still in the initial stages of testing it, but right now it seems to have everything we need
  • There is a application called GitX which has a very nice interface that shows all commits and lets you commit to your local version of the repository. However (at the moment) you still need to use the command line to update your local filesystem from the server repository (using Terminal, go to the directory and type git pull) and then push your changes back to the server repository (git push)
Comments { 0 }