0% found this document useful (0 votes)
7 views4 pages

Generate SSH Keys and Connect Systems

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)
7 views4 pages

Generate SSH Keys and Connect Systems

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-B

Step 1:- generate private and public key:--


[root@localhost 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):

Created directory '/root/.ssh'.

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:ox+zjNd14PkSt+BYvkDdOSvWs7/Y8vV1w3zyumZ2Yew root@[Link]

The key's randomart image is:

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

| |

| |

| |

| ... . |

| S ...o= |

| . o B.=* |

| . o..*o*B=*|

| +.+oo+oOEO|

| ..+ .B*O=|

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

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

[root@localhost .ssh]# ls

id_rsa id_rsa.pub
[root@localhost .ssh]# ifconfig

ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

inet [Link] netmask [Link] broadcast [Link]

inet6 fe80::20c:29ff:fe59:2d25 prefixlen 64 scopeid 0x20<link>

inet6 fd01::20c:29ff:fe59:2d25 prefixlen 64 scopeid 0x0<global>

ether 00:0c:29:59:2d:25 txqueuelen 1000 (Ethernet)

RX packets 1755 bytes 2204558 (2.1 MiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 954 bytes 81169 (79.2 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

inet [Link] netmask [Link]

inet6 ::1 prefixlen 128 scopeid 0x10<host>

loop txqueuelen 1000 (Local Loopback)

RX packets 48 bytes 4080 (3.9 KiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 48 bytes 4080 (3.9 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500

inet [Link] netmask [Link] broadcast [Link]

ether 52:54:00:03:d2:bf txqueuelen 1000 (Ethernet)

RX packets 0 bytes 0 (0.0 B)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 0 bytes 0 (0.0 B)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


[root@localhost .ssh]#

[root@localhost .ssh]# ping [Link]

PING [Link] ([Link]) 56(84) bytes of data.

64 bytes from [Link]: icmp_seq=1 ttl=64 time=0.455 ms

^Z

[1]+ Stopped ping [Link]

[root@localhost .ssh]# ssh [Link]

The authenticity of host '[Link] ([Link])' can't be established.

ECDSA key fingerprint is SHA256:Tvqf2fMZgNKxxBkUAzwGtd30VnJ7o5msZS+waEiLsic.

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

Please type 'yes', 'no' or the fingerprint: yes

Warning: Permanently added '[Link]' (ECDSA) to the list of known hosts.

root@[Link]'s password:

Activate the web console with: systemctl enable --now [Link]

This system is not registered to Red Hat Insights. See [Link]

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

Last login: Mon May 2 09:25:19 2022

[root@client2 ~]# exit

logout

Connection to [Link] closed.

Step 2:- now copy public key to system-A from system -B


[root@localhost .ssh]# ssh-copy-id [Link]

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"


/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

root@[Link]'s password:

Number of key(s) added: 1

Now try logging into the machine, with: "ssh '[Link]'"

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

[root@localhost .ssh]# cd

[root@localhost ~]# ssh [Link]

Activate the web console with: systemctl enable --now [Link]

This system is not registered to Red Hat Insights. See [Link]

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

Last login: Mon May 2 09:36:31 2022 from [Link]

[root@client2 ~]# exit

logout

Connection to [Link] closed.

[root@localhost ~]#

You might also like