• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

ssh-keygen: command not found

by admin

ssh-keygen utility generates, manages, and converts authentication keys for ssh. When using ssh-keygen to create a key, the -t option must be specified to identify the type of key to create.

The ssh-keygen utility generates an SSH key pair for authentication with the server. This utility is bundled with OpenSSH and by default, it creates a 2048-bit RSA key pair. It supports RSA and DSA, both with different lengths of keys. A key length of 4096 bits is recommended for establishing a secure connection between two machines.

You might encounter the below error when generating an ssh-key for your client:

-bash: ssh-keygen: command not found

The ssh-keygen comes bundled with the OpenSSH package, but in case you do not have it installed on your system, you can install it using the below commands as per your choice of the operating system.

Distribution Command
OS X brew install openssh
Debian apt-get install openssh-client
Ubuntu apt-get install openssh-client
Alpine apk add openssh
Arch Linux pacman -S openssh
Kali Linux apt-get install openssh-client
CentOS yum install openssh
Fedora dnf install openssh
Raspbian apt-get install openssh-client
Docker docker run cmd.cat/ssh-keygen ssh-keygen

ssh-keygen Command Examples

1. Generate a key interactively:

$ ssh-keygen

2. Specify file in which to save the key:

$ ssh-keygen -f {{~/.ssh/filename}}

3. Generate an ed25519 key with 100 key derivation function rounds:

$ ssh-keygen -t {{ed25519}} -a {{100}}

4. Generate an RSA 4096-bit key with email as a comment:

$ ssh-keygen -t {{dsa|ecdsa|ed25519|rsa}} -b {{4096}} -C "{{comment|email}}"

5. Remove the keys of a host from the known_hosts file (useful when a known host has a new key):

$ ssh-keygen -R {{remote_host}}

6. Retrieve the fingerprint of a key in MD5 Hex:

$ ssh-keygen -l -E {{md5}} -f {{~/.ssh/filename}}

7. Change the password of a key:

$ ssh-keygen -p -f {{~/.ssh/filename}}

8. Change the type of the key format (for example from OPENSSH format to PEM), the file will be rewritten in-place:

$ ssh-keygen -p -N "" -m {{PEM}} -f {{~/.ssh/OpenSSH_private_key}}

Filed Under: Linux

Some more articles you might also be interested in …

  1. ldconfig Command Options
  2. How to avoid ssh from prompting key passphrase for passwordless logins
  3. How to extend an LVM swap partition in Linux
  4. What are the mount options to improve ext4 filesystem performance in Linux
  5. A File Is Claimed to Be Disappearing – How to monitor a file for deletion in Linux
  6. How to Disable TLS 1.1 Cockpit port 9090
  7. The /var/log/messages is empty, and so are the rotated log files such as messages.0, messages.1
  8. mkfs Command Examples in Linux
  9. groupmems Command Examples in Linux
  10. How to Read Audit Log in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • grpck command – Remove corrupt or duplicate entries in the /etc/group and /etc/gshadow files.
  • xxd command – Expressed in hexadecimal form
  • sesearch: command not found
  • macof: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright