Saturday 22 July 2017

SSH Key Management on Ubuntu

I installed my notebook with Ubuntu 16.04 LTS. Now I must manage the different keys I use to access my GIT repositories on different hosts/services. I found some interesting hints I resume here.

New SSH key Generation

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
For each host/service I use a named key, here the example for GitHub:
Enter a file in which to save the key (/home/you/.ssh/id_rsa): \\
/home/you/.ssh/gitHubKey [Press Enter]

Host - Key Specific Configuration

Host github
    HostName github.com
    User your_git_user
    IdentityFile ~/.ssh/gitHubKey
Using this configuration only the given key will be tryed, however the URL must be corrected to use github instead of github.com
git@github:your_login_name/your_repository.git
Notice: change the permissions of the file ~/.ssh/config using chmod 644.

The result is a clean an self explanatory configuration.

No comments:

Post a Comment