Search

3.2.2. Generating Keys Manually

download PDF
The following instructions describe how to generate a new pair of RSA or DSA keys.
  1. Run the following command to generate a pair of keys, replacing KeyType with the type of key to generate:
    $ ssh-keygen -t KeyType
  2. Press Enter when prompted to save the key file in the default location:
    ...
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/username/.ssh/id_rsa): /home/username/.ssh/id_rsa

    Note

    Red Hat recommends to save all SSH keys in the default location. If an id_rsa file already exists, rename the new SSH key file to avoid overwriting the existing one.
  3. Enter a passphrase or leave blank when prompted, then press Enter:
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/username/.ssh/id_rsa
    Your public key has been saved in /home/username/.ssh/id_rsa.pub.
    ...
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.