Basic usage details of SSH's ES1en ES2en command

  • 2020-12-13 19:11:40
  • OfStack

ssh public key authentication is one of the methods of ssh authentication. ssh password-free login can be achieved by public key authentication, and ssh of git can also be authenticated by public key.

In the home directory of the user directory, there are 1.ssh directory, and almost all the files related to the current user's ssh configuration authentication are in this directory.

ssh-keygen can be used to generate the public and private key files required for ssh public key authentication.

When using ES18en-ES19en, please enter the ~/.ssh directory first. If it does not exist, please create it first. Also ensure that ~/.ssh and all parent directories have permissions no greater than 711

The generated file name and file location

Using ES27en-ES28en will generate two files in ~/.ssh/directory. When the file name and key type are not specified, the default generated two files are:

id_rsa

id_rsa.pub

The first is a private key file and the second is a public key file.

When generating ssh key, the file name of the generated file can be specified through the -ES43en option, as follows:


[huqiu@101 .ssh]$ ssh-keygen -f test  -C "test key"
               ~~ The file name   ~~~~  note 

If you do not specify a filename, you are asked to enter a filename:


[huqiu@101 .ssh]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/huqiu/.ssh/id_rsa):

You can enter the name of the file you want, here we type test.

You are then asked if you need to enter a password. After you enter your password, enter your password every time. Please decide whether you need the password according to your security needs. If not, just press enter:


[huqiu@101 .ssh]$ ssh-keygen -t rsa -f test -C "test key"
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

If the file name is test, the result is:


[huqiu@101 .ssh]$ ll test*
-rw------- 1 huqiu huqiu 1675 Sep 15 13:24 test
-rw-r--r-- 1 huqiu huqiu 390 Sep 15 13:24 test.pub

In the command generated above, the -ES60en option is the note in the public key file:


[huqiu@101 .ssh]$ cat test.pub
ssh-rsa
AAAAB3NzaC1yc2EAAAABIwAAAQEAlgjiMw7AskxbvpQY9rmZPQxQBzh9laxFvbaini2EgmQkNsXBA9WJOXn2YBJauoiVsdUKBWA97avjsobrTxsCYvFr1yQQvTfTlbqlqGNIhQc/3HjTl2pIkClpDWvBrRN+jpyESS4MNbfOL1qjT4c/QhGvj6U6HrN6kUyn58oyyJpTzOLG74AZELJ2Led57QvTw1yJXZuAMWioR0A3BGd25fdocLX3ebux6ya8AsloOVYfsAqGlggrARe6FXjLfMH4a/nxaAdiDYVXU/Vr1ybK9P7SfyEDGJi3JtgiPUlA6vPxUC
E+9IJPQaqqeqCGzrJ6G/XO7om1v9YLLG/H/ZN2tQ== test key
                      ~~~~ note 

In order for private and public key files to work in authentication, make sure the permissions are correct.

For.ssh and the parent folder, current user 1 must have execute permissions, and other users can only have execute permissions at most.

The same is true for public and private key files: current user 1 must have execute permissions, and other users can only have execute permissions at most.

The above is the basic usage of THE ES72en-ES73en command and I hope it is useful to you. Please see the following related articles for more information on the usage of ES74en-ES75en


Related articles: