---
# System prepended metadata

title: About create SSH key on Ubuntu

---

# About create SSH key on Ubuntu

refference : [How to Set Up SSH Keys on Ubuntu 20.04](https://linuxize.com/post/how-to-set-up-ssh-keys-on-ubuntu-20-04/)

---
## Creating SSH keys on Ubuntu 


1. To check whether the key files exist. 

```linux
$ ls -l ~/.ssh/id_*.pub
```

2. To generate SSH key pair with your email

```linux
$ ssh-keygen -t rsa -C "your_email@domain.com"
```

* Or you can set the SSH key size

```linux
$ ssh-keygen -i rsa -b 4096 -C "your _email@domain.com"
```

3. Save the key file
```
Enter file in which to save the key (/Users/[you]/.ssh/id_rsa): [Press enter]
```
* You can change the file name ex: xxx_rsa


4. SSH program will ask you to enter passphrase
```
Enter passphrase (empty for no passphrase):
```
5. Show the  fingerprint 
```
SHA256:*********   your@email
```



## We have to use ssh-agent to control our ssh key

reference:[ssh-agent introduction](https://www.ssh.com/academy/ssh/agent)

* ssh-agent is a program on Linux systems

1. Starting ssh-agent on linux
```linux
$eval `ssh-agent -s`
Agent pid *****
```
* use "eval" to execute the ssh-agent


2. Add the rsa key into ssh-agent
```
$ssh-add ~/.ssh/id_rsa
```
* You can choose the key files
* Now you can use your SSH key on Ubuntu




