SSH key generation and use

1. The secret key for generating
[the root @ localhost ~] # SSH-keygen -t # RSA key pair generation, - T representative of the type, there are two kinds of RSA and DSA Generating public / Private Key pair RSA. The Enter File in Which to Save key The (/ the root /. SSH / id_rsa): # key file in the default storage location, press enter to the Created Directory ' /root/.ssh ' . enter a passphrase (empty for NO a passphrase): # enter key lock code, press Enter or leave blank directly Enter passphrase Same, Again: Your Identification has been saved in . / root / SSH . / id_rsa # generated private key Your public key has been savedin /root/.ssh/id_rsa.pub. #生成的公钥 The key fingerprint is: SHA256:K1qy928tkk1FUuzQtsdfsdf6dfdfPvHw9lQ+KNuZ4 [email protected] The key's randomart image is: +---[RSA 2048]----+ | +. | | o * . | | . .O + | | . *. * | | S =3+ | | . =... | | .oo =+ov+ | | ==o+B*3o. | | oo.3=EXO. | +----[SHA256]-----+


2. The public key distribution

SSH-Copy-ID -i ~ / .ssh / id_rsa.pub [email protected]


3. keys locked file can not be changed
the chattr + I
/root/.ssh/id_rsa
the chattr + I / the root /.ssh/id_rsa.pub

Guess you like

Origin www.cnblogs.com/bretzhao/p/11822161.html