0% found this document useful (0 votes)
14 views5 pages

SSH (Key Based Auth)

Uploaded by

Blakk Boy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

SSH (Key Based Auth)

Uploaded by

Blakk Boy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

System-A(192.168.0.

38)

[root@client2 Desktop]# ssh-keygen -t rsa -b 2048

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

/root/.ssh/id_rsa already exists.

Overwrite (y/n)? y

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

SHA256:DvUZkTsEAU9RySSgWwHNafqj1VyhNcU8tT1DJ66zQC4 [email protected]

The key's randomart image is:

+---[RSA 2048]----+

| .+++*B+*..o..|

| .=+ .O.+..+.|

| .o. o+o+ .oo.|

| .o ..++o . o|

| ...oE.=.o |

| +oo. . o |

| o .. . |

| . |

| |

+----[SHA256]-----+

[root@client2 Desktop]#

[root@client2 Desktop]# cd /root/.ssh


[root@client2 .ssh]# ls

authorized_keys id_rsa id_rsa.pub known_hosts

[root@client2 .ssh]# ssh-copy-id 192.168.0.21

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already
installed

/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install
the new keys

[email protected]'s password:

Number of key(s) added: 1

Now try logging into the machine, with: "ssh '192.168.0.21'"

and check to make sure that only the key(s) you wanted were added.

[root@client2 .ssh]# ssh [email protected]

Activate the web console with: systemctl enable --now cockpit.socket

This system is not registered to Red Hat Insights. See https://cloud.redhat.com/

To register this system, run: insights-client --register

Last login: Mon May 9 18:36:48 2022 from 192.168.0.38

[root@server ~]# exit

logout

Connection to 192.168.0.21 closed.

[root@client2 .ssh]#
System-B

[root@server Desktop]# ssh-keygen -t rsa -b 4096

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

/root/.ssh/id_rsa already exists.

Overwrite (y/n)? y

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

SHA256:Qzzi0TlmZEHpN41zdhwcjyrnhs/dRqqX4ZQi3GmYp4g [email protected]

The key's randomart image is:

+---[RSA 4096]----+

| .=o ... |

| =.. oo |

| o.X o ....|

| . *.o= +.o |

| . So.Ooo . |

| .==* + .|

| . ..=o+ = |

| E . .+ .=..|

| +o...|

+----[SHA256]-----+

[root@server Desktop]# cd /root/.ssh

[root@server .ssh]# ls
authorized_keys id_rsa id_rsa.pub known_hosts

[root@server .ssh]# ssh-copy-id 192.168.0.21

The authenticity of host '192.168.0.21 (192.168.0.21)' can't be established.

ECDSA key fingerprint is SHA256:vnSHDaXYpZg9PrsUxo5KE0BJG+3EVnZTrslDQAkvpdM.

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already
installed

/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install
the new keys

[email protected]'s password:

Number of key(s) added: 1

Now try logging into the machine, with: "ssh '192.168.0.21'"

and check to make sure that only the key(s) you wanted were added.

[root@server .ssh]# ssh-copy-id 192.168.0.38

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already
installed

/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install
the new keys

[email protected]'s password:

Number of key(s) added: 1

Now try logging into the machine, with: "ssh '192.168.0.38'"

and check to make sure that only the key(s) you wanted were added.

[root@server .ssh]# ssh [email protected]


Activate the web console with: systemctl enable --now cockpit.socket

This system is not registered to Red Hat Insights. See https://cloud.redhat.com/

To register this system, run: insights-client --register

Last login: Mon May 9 18:37:15 2022 from 192.168.0.21

[root@client2 ~]# exit

logout

Connection to 192.168.0.38 closed.

[root@server .ssh]#

You might also like