Ssh Keygen Passphrase

Posted on by
Ssh Keygen Passphrase Rating: 8,4/10 3589 votes

Ssh-keygen is a standard component of the Secure Shell (SSH) protocol suite found on Unix, Unix-like and Microsoft Windows computer systems used to establish secure shell sessions between remote computers over insecure networks, through the use of various cryptographic techniques. The ssh-keygen utility is used to generate, manage, and convert authentication keys.

ssh-keygen
Developer(s)The OpenBSD Project
Written inC
Operating systemUnix, Unix-like, Microsoft Windows
TypeCommand
LicenseBSD, ISC, public domain
Websitewww.openssh.com

Ssh-keygen -t rsa -f /home/oracle/.ssh/idrsa -q -P ' The -P is the passphrase option, and ' is the empty passphrase. $ man ssh-keygen. It is possible to specify a passphrase when generating the key; that passphrase will be used to encrypt the private part of this file using 128-bit AES. So this passphrase just encrypts the key locally. An attacker with access to your system will not be. Oct 05, 2007  ssh-keygen is the basic way for generating keys for such kind of authentication. I will also explain how to maintain those keys by changing their associated comments and more importantly by changing the passphrases using this handy utility. Generating Keys. Generating public keys for authentication is the basic and most often used feature of.

ssh-keygen is a standard component of the Secure Shell (SSH) protocol suite found on Unix, Unix-like and Microsoft Windows computer systems used to establish secure shell sessions between remote computers over insecure networks, through the use of various cryptographic techniques. The ssh-keygen utility is used to generate, manage, and convert authentication keys.

Overview[edit]

ssh-keygen is able to generate a key using one of three different digital signature algorithms. With the help of the ssh-keygen tool, a user can create passphrase keys for any of these key types (to provide for unattended operation, the passphrase can be left empty, at increased risk). These keys differ from keys used by the related tool GNU Privacy Guard. Manzil pdf download.

OpenSSH-based client and server programs have been included in Windows 10 since version 1803. The SSH client and key agent are enabled and available by default and the SSH server is an optional Feature-on-Demand.[1][2]

Key formats supported[edit]

ProtocolGeneration
RSA1
DSA2
ECDSA3
ed255194

Originally, with SSH protocol version 1 (now deprecated) only the RSA algorithm was supported. As of 2016, RSA is still considered strong, but the recommended key length has increased over time.

The SSH protocol version 2 additionally introduced support for the DSA algorithm. As the DSA algorithm has ties to the American National Security Agency (NSA), aspects of its security have been called into question by Edward Snowden's global surveillance disclosures, particularly in light of the Bullrun decryption program.

Subsequently, OpenSSH added support for a third digital signature algorithm, ECDSA (this key format no longer uses the previous PEM file format for private keys, nor does it depend upon the OpenSSL library to provide the cryptographic implementation).

A fourth format is supported using ed25519, originally developed by independent cryptography researcher Daniel J. Bernstein.

ssh-keygen command syntax[edit]

The syntax of the ssh-keygen command is as follows:

Some important options of the ssh-keygen command are as follows:

ssh-keygen command optionsdescription
-b bitsSpecifies the number of bits in the key to create. The minimum bit length is 768 bits and the default length is 2048 bits.
-C commentProvides new comment.
-pRequests changing the passphrase of a private key file instead of creating a new private key.
-tSpecifies the type of key to create.
-oUse the new OpenSSH format.
-qquiets ssh-keygen. It is used by the /etc/rc file while creating a new key.
-NProvides a new Passphrase.
-F (or -B)For ssh-keygen2, dumps the key's fingerprint in Bubble Babble format

Files used by the ssh-keygen utility[edit]

The ssh-keygen utility uses various files for storing public and private keys. The files used by ssh-keygen utility are as follows:

  • $HOME/.ssh/identity: The $HOME/.ssh/identity file contains the RSA private key when using the SSH protocol version 1.
  • $HOME/.ssh/identity.pub: The $HOME/.ssh/identity.pub file contains the RSA public key for authentication when you are using the SSH protocol version 1. A user should copy its contents in the $HOME/.ssh/authorized_keys file of the remote system where a user wants to log in using RSA authentication.
  • $HOME/.ssh/id_dsa: The $HOME/.ssh/id_dsa file contains the protocol version 2 DSA authentication identity of the user.
  • $HOME/.ssh/id_dsa.pub: The $HOME/.ssh/id_dsa.pub file contains the DSA public key for authentication when you are using the SSH protocol version 2. A user should copy its contents in the $HOME/.ssh/authorized_keys file of the remote system where a user wants to log in using DSA authentication.
  • $HOME/.ssh/id_rsa: The $HOME/.ssh/id_rsa file contains the protocol version 2 RSA authentication identity of the user. This file should not be readable by anyone but the user.
  • $HOME/.ssh/id_rsa.pub: The $HOME/.ssh/id_rsa.pub file contains the protocol version 2 RSA public key for authentication. The contents of this file should be added to $HOME/.ssh/authorized_keys on all computers where a user wishes to log in using public key authentication.

References[edit]

  1. ^https://devblogs.microsoft.com/commandline/windows10v1803/
  2. ^https://devblogs.microsoft.com/powershell/using-the-openssh-beta-in-windows-10-fall-creators-update-and-windows-server-1709/

External links[edit]

The Wikibook OpenSSH has a page on the topic of: ssh-keygen
  • Generating an SSH key, a guide from GitHub
  • ssh-keygen manual from the OpenBSD project
  • Linux man page from die.net
Retrieved from 'https://en.wikipedia.org/w/index.php?title=Ssh-keygen&oldid=903146100'
Active4 years ago

Before I started at my current job (at a small business), my office had no firewall on the network and literally nothing was ever being backed up. Now that I've signed on as a dedicated sysadmin / one-man-IT-department, I've been doing what I can to change this. After explaining to my boss how vulnerable we were, he's allowed me to set up some backup servers, one of which is at his house.

Right now, I'm trying to get everything set so that I can automate daily backups. I am planning to use rsync through ssh to do this. For security's sake as well as for ease of automation, I was planning to disable ssh password login and only use rsa key validation. Well, if I have an rsa passphrase set, then I would still have to enter a passsword, and that's a problem.

Does not having an rsa passphrase make things significantly less secure? I'm the only person in the company who has any sort of a clue about this kind of thing, so I'm not too worried about someone calling up a terminal on my machine (which is always locked when I'm AFK, anyway) and ssh-ing into one of the backup servers and doing any damage. I'm still very, very new to the world of systems administration, and this is my first time doing anything like this, and I don't want to leave any holes in the security setup.

The computers in question here are running Ubuntu 10.10, SME Server, and OSX 10.6, if that somehow makes any sort of a difference.

Sathyajith Bhat
53.8k30 gold badges160 silver badges254 bronze badges
eckzaeckza
5291 gold badge5 silver badges16 bronze badges

3 Answers

As you know, the advantage that the passphrase gives you is that if someone is able to read your private key, they are 'unable' to use it.

What Is Passphrase In Ssh

If someone is able to access that private key, you should take it for granted that they have access(ed)/compromised whatever machines are set up with the public key. Things like .bash_history or .ssh/config only make this easier, even if your .ssh/known_hosts is obfuscated.

Ssh-keygen passphrase empty

Ssh Key Passphrase

Not having a password on your key isn't the end of the world, here are 3 ideas to try and help you secure yourself a little better despite this. (The biggie is the second, read that if nothing else)

  1. Don't just use the same key across all machines and users. Generate each user on each machine (that needs to do this kind of thing) its own key pair. This will let you keep fine grained control on what is able to ssh where.

  2. When adding the key to your authorized_keys file, you can lock it down to only be able to run a specific command, or use it only from a specific host.

    See man ssh and search for command= and from=

    The syntax is something like:

    from='1.2.3.4',command='/path/to/executable argument' ssh-rsa key name

    i.e. pop 'rsync' in there and only 'rsync' could be called by your key, and only from the IP address 1.2.3.4. Multiple IPs can be separated by ,. Host names are also supported.

  3. Another thing that springs to mind is the 'AllowUser' directive in your sshd_config

    Drivers license creator free. AllowUsers

    This keyword can be followed by a list of user name patterns, separated by spaces. If specified, login is allowed only for user names that match one of the patterns. '*' and '?' can be used as wildcards in the patterns. Only user names are valid; a numerical user ID is not recognized. By default, login is allowed for all users. If the pattern takes the form USER@HOST then USER and HOST are separately checked, restricting logins to particular users from particular hosts.

    That basically ensures that the user can only log in from a certain location. (although it accepts wildcards too) Not going to solve all of your problems but it'll at least make it harder for others.

a CVn
25.1k9 gold badges79 silver badges128 bronze badges
PriceChildPriceChild
4,2321 gold badge20 silver badges30 bronze badges

You can use something like keychain to make having a passphrase less painful. This is slightly more secure than using a passwordless login, and can be used in combination with the other answers here. PriceChild's answer was pretty good.

Community
Faheem MithaFaheem Mitha

Personally I use DSA not RSA, mainly because it's what I have always used and I know it 'just works', but the theory I guess is the same. You could replace dsa with rsa in the below.

On the source:

Then copy the contents of the .ssh/id_dsa.pub file into .ssh/authorized_keys in the user account on the destination.

Then you should just be able to ssh between the source and the destination with no passwords.

MajenkoMajenko

Ssh Key Passphrase Remove

28.2k3 gold badges50 silver badges75 bronze badges

Passphrase For Ssh Keygen

Not the answer you're looking for? Browse other questions tagged securitysshrsyncrsapassphrase or ask your own question.