Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Отчет по лабораторной №4 ИСиУ.docx
Скачиваний:
5
Добавлен:
03.10.2022
Размер:
1.12 Mб
Скачать

10. Отключившись от удаленного узла (команда logout), на локальном хосте сформировать зашифрованные ключи, воспользовавшись командой ssh-keygen.

ssh-keygen

Generating public/private rsa key pair.

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

/home/student/.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 /home/student/.ssh/id_rsa.

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

The key fingerprint is:

SHA256:p5fIVSIIiCQ/c9rnWrzmEQOAIhIWmUil/hC9MRL77w4 student@521-01

The key's randomart image is:

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

|*X*o.        |

|X+*. . .     |

|+=++o . . . . |

|. +*+.   . o |

| o.o. + S o  |

|  o .+ + = . |

|   E .= + o  |

| oo.o .   |

| o=o      |

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

11. Используя команду scp с указанием места расположения файла публичного ключа на локальной системе (публичный ключ хранится в файле /home/student/.ssh/id_rsa.pub), произвести его передачу по шифрованному туннелю на удаленный узел в каталог /home/student_nn/.ssh/ и сохранить файл публичного ключа под именем authorized_keys.

12. Воспользовавшись командой ssh -l student_nn 172.16.100.88, снова сделать попытку подключения к удаленной системе. Отметить отличия в процедурах подключения и регистрации пользователя на удаленной системе по сравнению с аутентификацией по паролю.

ssh -l student_01 172.16.100.88

Linux opentest 2.6.26-2-686 #1 SMP Sun Mar 4 22:19:19 UTC 2012 i686

The programs included with the Debian GNU/Linux system are free software;

the exact distribution terms for each program are described in the

individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent

permitted by applicable law.

You have mail.

Last login: Thu Oct 14 16:58:41 2021 from 172.16.100.21

13. Аналогично, с помощью команды scp произвести повторную передачу текстового файла на удаленный узел. Убедиться в наличии переданной копии файла на удаленном хосте. Отметить отличия в процедуре передачи файла.

scp -v -o User=student_01 /home/student/lab_041.txt 172.16.100.88:/home/student_01/

Executing: program /usr/bin/ssh host 172.16.100.88, user (unspecified), command scp -v -t /home/student_01/

OpenSSH_7.9p1 Debian-9, OpenSSL 1.1.1b  26 Feb 2019

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: /etc/ssh/ssh_config line 19: Applying options for *

debug1: Connecting to 172.16.100.88 [172.16.100.88] port 22.

debug1: Connection established.

debug1: identity file /home/student/.ssh/id_rsa type 0

debug1: identity file /home/student/.ssh/id_rsa-cert type -1

debug1: identity file /home/student/.ssh/id_dsa type -1

debug1: identity file /home/student/.ssh/id_dsa-cert type -1

debug1: identity file /home/student/.ssh/id_ecdsa type -1

debug1: identity file /home/student/.ssh/id_ecdsa-cert type -1

debug1: identity file /home/student/.ssh/id_ed25519 type -1

debug1: identity file /home/student/.ssh/id_ed25519-cert type -1

debug1: identity file /home/student/.ssh/id_xmss type -1

debug1: identity file /home/student/.ssh/id_xmss-cert type -1

debug1: Local version string SSH-2.0-OpenSSH_7.9p1 Debian-9

debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5

debug1: match: OpenSSH_5.1p1 Debian-5 pat OpenSSH_5* compat 0x0c000002

debug1: Authenticating to 172.16.100.88:22 as 'student_01'

debug1: SSH2_MSG_KEXINIT sent

debug1: SSH2_MSG_KEXINIT received

debug1: kex: algorithm: diffie-hellman-group-exchange-sha256

debug1: kex: host key algorithm: ssh-rsa

debug1: kex: server->client cipher: aes128-ctr MAC: umac-64@openssh.com compression: none

debug1: kex: client->server cipher: aes128-ctr MAC: umac-64@openssh.com compression: none

debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192) sent

debug1: got SSH2_MSG_KEX_DH_GEX_GROUP

debug1: SSH2_MSG_KEX_DH_GEX_INIT sent

debug1: got SSH2_MSG_KEX_DH_GEX_REPLY

debug1: Server host key: ssh-rsa SHA256:toYD69y6puKpyeDYai8x1vg92nxr2YcH57HBVaUzKBs

debug1: Host '172.16.100.88' is known and matches the RSA host key.

debug1: Found key in /home/student/.ssh/known_hosts:4

debug1: rekey after 4294967296 blocks

debug1: SSH2_MSG_NEWKEYS sent

debug1: expecting SSH2_MSG_NEWKEYS

debug1: SSH2_MSG_NEWKEYS received

debug1: rekey after 4294967296 blocks

debug1: Will attempt key: /home/student/.ssh/id_rsa RSA SHA256:p5fIVSIIiCQ/c9rnWrzmEQOAIhIWmUil/hC9MRL77w4

debug1: Will attempt key: /home/student/.ssh/id_dsa

debug1: Will attempt key: /home/student/.ssh/id_ecdsa

debug1: Will attempt key: /home/student/.ssh/id_ed25519

debug1: Will attempt key: /home/student/.ssh/id_xmss

debug1: SSH2_MSG_SERVICE_ACCEPT received

debug1: Authentications that can continue: publickey,password

debug1: Next authentication method: publickey

debug1: Offering public key: /home/student/.ssh/id_rsa RSA SHA256:p5fIVSIIiCQ/c9rnWrzmEQOAIhIWmUil/hC9MRL77w4

debug1: Server accepts key: /home/student/.ssh/id_rsa RSA SHA256:p5fIVSIIiCQ/c9rnWrzmEQOAIhIWmUil/hC9MRL77w4

debug1: Authentication succeeded (publickey).

Authenticated to 172.16.100.88 ([172.16.100.88]:22).

debug1: channel 0: new [client-session]

debug1: Requesting no-more-sessions@openssh.com

debug1: Entering interactive session.

debug1: pledge: network

debug1: Sending environment.

debug1: Sending env LANG = ru_RU.UTF-8

debug1: Sending command: scp -v -t /home/student_01/

Sending file modes: C0644 23 lab_041.txt

lab_041.txt              0% 0 0.0KB/s   --:-- ETASink: C0644 23 lab_041.txt

lab_041.txt            100%   23 42.8KB/s   00:00    

debug1: client_input_channel_req: channel 0 rtype exit-status reply 0

debug1: channel 0: free: client-session, nchannels 1

debug1: fd 0 clearing O_NONBLOCK

Transferred: sent 3304, received 2888 bytes, in 0.0 seconds

Bytes per second: sent 306455.7, received 267870.5

debug1: Exit status 0