You are not logged in. Click here to log in.

codebeamer Application Lifecycle Management (ALM)

Search In Project

Search inClear

Setting Up SSH Authentication for Git and Mercurial

SSH Authentication is supported only if codeBeamer is running on Linux/Unix server. If port redirection is used for codebeamer, please check the value of CB_BASE_URL in scmloop/scm-ssh script.

Generating SSH keys

A keypair is only valid if it is a pair: your local operating system user needs access to both (in Unix/Linux enviroment: ~/.ssh directory). If you login to another local user, you must either:
  • Create a new keypair and provide the public key to codeBeamer (see below how) – this is the recommended method, as codeBeamer can handle multiple keys per account.
  • Move keypair files (private + public) from the previous user's ~/.ssh directory to the new user's directory. Check that the permissions are correct on the files and directory in this case: ~/.ssh directory must have "rwx------" access rights (octal 700) while key files (e.g. id_rsa, id_rsa.pub) must have "rw-------" access rights (only owner can read and write, octal 600). OpenSSH will not allow you to connect to the remote host if the permissions are not restrictive enough.
  • On the codeBeamer server in /etc/ssh/sshd_config either all operating system accounts or at least the account used for SSH operations must be allowed as below:
    AllowUsers=root codebeamer
    

AllowUsers must contain all operating system accounts allowed to login via SSH.

You can now generate your keys for your operating system user and associate them with your codeBeamer account.

Linux and Mac OS X

  1. Open a terminal window on your desktop machine
  2. Type the following commands: use your own user ID and accept the default options.
    $ ssh-keygen
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/zk/.ssh/id_rsa):
    Created directory '/home/zk/.ssh'.
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/zk/.ssh/id_rsa.
    Your public key has been saved in /home/zk/.ssh/id_rsa.pub.
    The key fingerprint is:
    0f:a9:76:db:20:f9:cc:25:42:cc:65:7e:ce:ac:97:03 zk@zk-ubuntu
    The key's randomart image is:
    +--[ RSA 2048]----+
    |                 |
    |                 |
    |          o      |
    |       o *       |
    |        S .      |
    |      EB o       |
    |      =.B.+      |
    |     . B+* .     |
    |      ..=..      |
    +-----------------+

Finally run the following command:

cat $HOME/.ssh/id_rsa.pub

and copy the output. This is your public key.

Windows

On Windows, Git (http://msysgit.github.io/) comes with a tool called Git Bash. You can access this trhough Start > Programs > Git. Using this tool you can generate the keys following the same steps as for Linux.

On Windows SSH keys can be generated using PuTTYGen (the download link can be found on the PuTTY Download Page. If you're using Mercurial also download ptlink from this page.

Start PuTTYGen, generate the key (Generate button) and save the private key to a file (Save private key button) like 'key.ppk' under your home directory. Copy the content of Public key for pasting into OpenSSH authorized_keys file textbox (this is your public key).

Figure: Generate SSH Key with PuttyGen
You must login to see this link. Register now, if you have no user account yet.

For Mercurial you have to edit the .hgrc file in your home directory. Add the following lines (if the file doesn't exist just create it):

[ui]
ssh = "C:\Program Files\PuTTY\ptlink.exe" -i "USERHOME\key.ppk"

Note that the path of ptlink can be different on your environment. Substitute USERHOME with your home directory.

Before first accessing codeBeamer through ssh run the following command:

"C:\Program Files\PuTTY\ptlink.exe" ssh://CODEBEAMER_URL

This will add the host key of codeBeamer to the known hosts.

Associating Your SSH key with Your codeBeamer Account

You can associate your generated public key with your codeBeamer account using the following steps:

  1. Return to your codeBeamer window
  2. Log in again or just select the My Start tab
  3. Now select the Account Info tab
  4. Select the Edit Public SSH Keys link
  5. Upload or copy-paste the public key from the terminal (linux) or from PuTTYGen (Windows) into the boxes and save it.
  6. Save

Setting up a custom private-key

If you want to use the custom private-key - something other than .ssh/id_rsa- and you want to use this with codeBeamer and your git cloning or authentication fails then you may have to set-up git to use this custom private key. There are several ways to do this, see How to tell git which private key to use.

This video also illustrates how to do this: How To Custom SSH key video