• 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. mpstat: command not found
  2. date Command Examples in Linux
  3. How to find if NUMA configuration is enabled or disabled?
  4. How to Check vendor of installed RPM packages in Linux
  5. xrpd: command not found
  6. pvcreate error : Can’t open /dev/sdx exclusively. Mounted filesystem?
  7. grub-mkconfig: command not found
  8. Command ‘df -i’ Shows ‘Inode=0’ on BTRFS File System
  9. du: command not found
  10. edquota Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • nixos-rebuild Command Examples in Linux
  • nixos-option: Command Examples in Linux
  • nixos-container : Command Examples in Linux
  • nitrogen Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright