- GitLab Cookbook
- Jeroen van Baarsen
- 388字
- 2021-08-05 16:55:05
Generating your SSH key on Unix-like systems
Generating an SSH key on Linux and OS X is easy; they come with a built-in tool to do this, called ssh-keygen
.
How to do it…
In the following steps, we will create an SSH key for your Unix system:
- First, we are going to check whether you have any SSH keys present. Open your terminal and enter the following command:
$ ls ~/.ssh
- If you have a file named
id_rsa.pub
orid_dsa.pub
, you can skip this recipe. - To generate a new SSH key, you need to open your terminal and enter the following command:
$ ssh-keygen -t rsa -C "Comment for key"
The comment can be anything you want; it makes it easier for you to see which key it is when you open the key file.
- Now, we get to the question of what you want to name your key. Just press Enter.
- You will be asked to enter a passphrase. Enter it, and be sure to choose a strong password.
You should see the following screenshot:
Your SSH key is now generated.
How it works…
We just created our personal SSH key: one key is the id_rsa
file and one is the id_rsa.pub
file. Whenever you need to provide your public SSH key, make sure that you use the id_rsa.pub
file. The other file should remain safely on your machine, as this is the private key. If you feel this key has been compromised, you should create a new SSH key and revoke the SSH key on all the systems you used it for.
The SSH key helps you to authorize yourself in your GitLab instance without having to use a username and password.
One thing that is important while creating your SSH key is to remember to enter a passphrase. We use an SSH key because we believe that passwords are less secure, so you might think that if you're using an SSH key, you will be safe. This is not entirely true. When a person takes control over your private key, they have access to every system you have put your public key in. However, when you use a passphrase for your SSH key, not only do they have to steal your private key, but they also know the password that goes with it.
- Mastering OpenLayers 3
- Practical Data Analysis Cookbook
- UI設計基礎培訓教程
- Learning ArcGIS Pro
- Monitoring Elasticsearch
- AutoCAD VBA參數化繪圖程序開發與實戰編碼
- Elasticsearch for Hadoop
- Kotlin從基礎到實戰
- Unity 2D Game Development Cookbook
- 好好學Java:從零基礎到項目實戰
- LabVIEW虛擬儀器程序設計從入門到精通(第二版)
- Spring技術內幕:深入解析Spring架構與設計原理(第2版)
- ASP.NET求職寶典
- 監控的藝術:云原生時代的監控框架
- 分布式系統架構與開發:技術原理與面試題解析