48.3. SSH 키 생성

OpenSSH ssh-keygen 유틸리티를 사용하여 SSH 키를 생성할 수 있습니다.

절차

  1. RSA SSH 키를 생성하려면 다음 명령을 실행합니다.

    $ ssh-keygen -t rsa -C user@example.com
    Generating public/private rsa key pair.

    호스트 키를 생성하는 경우 user@example.comserver.example.com,1.2.3.4 와 같은 필수 호스트 이름으로 교체합니다.

  2. 키를 저장하는 파일을 지정하거나 Enter 키를 눌러 표시된 기본 위치를 수락합니다.

    Enter file in which to save the key (/home/user/.ssh/id_rsa):

    호스트 키를 생성하는 경우 기존 키를 덮어쓰지 않도록 키를 사용자의 ~/.ssh/ 디렉터리와 다른 위치에 저장하십시오. 예를 들어 /home/user/.ssh/host_keys.

  3. 개인 키의 암호를 지정하거나 Enter 키를 눌러 암호를 비워 둡니다.

    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/user/.ssh/id_rsa.
    Your public key has been saved in /home/user/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:ONxjcMX7hJ5zly8F8ID9fpbqcuxQK+ylVLKDMsJPxGA user4@example.com
    The key's randomart image is:
    +---[RSA 3072]----+
    |         ..o     |
    |         .o +    |
    |     E. .  o =   |
    |    ..o=  o . +  |
    |      +oS. = + o.|
    |    . .o .* B =.+|
    |     o + . X.+.= |
    |      + o o.*+. .|
    |       .   o=o . |
    +----[SHA256]-----+

    이 SSH 키를 업로드하려면 표시된 파일에 저장된 공개 키 문자열을 사용합니다.