CREATING SSH KEY PAIRS

Creating ssh key pairs is very important specially when you are working on a opensource project.If your SSH server is visible over the Internet, you should use public key authentication instead of passwords if at all possible.

With public key authentication, every computer has a public and a private “key” (a large number with particular mathematical properties). The private key is kept on the computer you log in from, while the public key is stored on the .ssh/authorized_keys file on all the computers you want to log in to. When you log in to a computer, the SSH server uses the public key to “lock” messages in a way that can only be “unlocked” by your private key – this means that even the most resourceful attacker can’t snoop on, or interfere with, your session. As an extra security measure, most SSH programs store the private key in a passphrase-protected format, so that if your computer is stolen or broken in to, you should have enough time to disable your old public key before they break the passphrase and start using your key. Wikipedia has a more detailed explanation of how keys work

STEPS FOR CREATING SSH KEY PAIRS :
  • First decide if you will be using SSH1 or SSH2 (or both). Most likely you’ll want to stick with SSH1 (until OpenSSH is installed at PPPL, or until SSH2 is installed, etc).
  • To generate public/private keypair for SSH1: 

        $ ssh-keygen       This will generate ~/.ssh/identity and ~/.ssh/identity.pub.

  • Do this on each machine you want to access (to/from) using ssh (only need to do this once on the PPPL unix cluster)
  • Take all of the identity.pub files (which contain a public key on one line) and create an ~/.ssh/authorized_keys file by placing the contents of each separate identity.pub file on a single line of the ~/.ssh/authorized_keys file (then place on all sshable hosts).
  • For SSH2, use ssh-keygen -t {rsa,dsa} (you choose between rsa keys or dsa keys, currently I use DSA), which will generate ~/.ssh/id_{dsa,rsa} and ~/.ssh/id_{dsa,rsa}.pub.
  • Follow instructions for SSH1 keys, but instead generate a ~/.ssh/authorized_keys2 file using the id_{dsa,rsa}.pub files.
Advertisements

INTRODUCING MERCURIAL

INTRODUCTION

I came across one more version control system when I started contributing to Mozilla Firefox.Mercurial is a cross-platform, distributed revision control tool for software developers. It is mainly implemented using the Python programming language, but includes a binary diff implementation written in C. It is supported on Windows and Unix-like systems, such as FreeBSD, Mac OS X and Linux. Mercurial is primarily a command line program but graphical user interface extensions are available.

INSTALLING MERCURIAL IN LINUX

$ sudo apt-get install mercurial

BASICS

CREATING A REPOSITORY

$ mkdir hg1
$ cd hg1
$ hg init

ADDING FILE

$ hg add <file-name>

REMOVING FILE

$ hg rm <file-name>

The following command removes the added file

$ hg addremove <file-name>

RENAMING FILE/DIRECTORY

$ hg rename <file/directory>

SHOW STATUS

$ hg status

SHOW REVISION HISTORY

$ hg log

CLONING A REPOSITORY

For example for cloning a small “hello, world” repository hosted at testingmercurial.com:

$ hg clone http://www.testingmercurial.com/repo/hello my-hello

MERGING

$ hg merge <url of repo>

COMMIT

$ hg commit -m “commit-message”

PUSHING YOUR BRANCH TO ANOTHER REPOSITORY

$ hg push <url of the repo>

PULLING CHANGES FORM A REPOSITORY

$ hg pull <url of the repo>

If you are satisfied with the changes you pull then merge it using

$ hg merge

$ hg commit -m “merged”

This is just the basics of mercurial for more information I would suggest to read some mercurial tutorials.One you can find here http://mercurial.selenic.com/wiki/Tutorial also many good books are available just  google it!So go ahead enjoy playing with mercurial.Cheers  🙂

Introducing Bazaar(vcs)

When I started contributing to Ubuntu on launchpad.I came across a version control system popularly used by launchpad developers.It is very easy to use and is flexible and I am going to share some of the basics with  you all 🙂

INTRODUCTION

Bazaar is a distributed revision control system sponsored by Canonical.It is written in Python programming language.

Bazaar give us the ability to track changes for a directory by turning it into something slightly more complicated than a directory that we call a branch. The branch not only stores how the directory looks right now, but also how it looked at various points in the past. Then, when we do something we wish we hadn’t, we can restore the directory to the way it looked at some point in the past.Version control systems give users the ability to save changes to a branch by “committing a revision“. The revision created is essentially a summary of the changes that were made since the last time the tree was saved.

INSTALLING BAZAAR

$sudo apt-get install bzr

Setting an email address via bzr whoami.

For setting a global identity, use

$bzr whoami “Your Name <email@example.com>”

For using a different address for a specific branch, enter the branch folder and use:

$ bzr whoami –branch “Your Name <email@example.com>”
Setting the email address in the ~/.bazaar/bazaar.conf  by adding the following lines.Note that
[DEFAULT] is case sensitive:
[DEFAULT]
email=Your Name <email@isp.com>

CREATING A REPO

$bzr init-repo <repo-name>

CREATING A BRANCH

$bzr init <branch-name>

ADDING FILES

  • Adding all files:

$bzr add

  • Adding a particular file:

$bzr add <filename>

COMMITTING CHANGES

$bzr commit -m “commit-message”

SOME USEFUL BAZAAR COMMANDS

$bzr status     # tells the changes made to the working directory since last revision.

$bzr diff        # shows the full text of changes to all files as a standard unified diff. This can be piped through many
programs such as ‘’patch’‘, ‘’diffstat’‘, ‘’filterdiff” and ‘’colordiff’‘

$bzr log        # shows the history of the branch by browsing its log

UPDATING BRANCH

$bzr merge <url of repo>

then commit changes if you are satisfied with it using

$bzr commit “merged”

PUSHING YOUR BRANCH TO OTHER REPO

$bzr push <url of repo>