A
A
awox2022-03-24 15:17:14
linux
awox, 2022-03-24 15:17:14

Is it possible to login to Linux server with only SSH Private Key?

Below are some test tasks in connection with which the question arose.

Task 1
Login to a remote server using ssh. You need to go to the host <IP>by port <SSH>. User (login) - user and password - password. On the host in your home directory, find and read the ssh-key file, save its contents, you will need it for the second task.

Task 2
Log in to the remote server <IP>using SSH, the admin user, and the ssh key obtained in the first task from the ssh-key file.

The contents of the ssh-key file:

-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn
NhAAAAAwEAAQAAAQEA0k/1iGwFkn0+/bgtf6iRAGHfzaClybEBjxpLAF1KICvkqacAi367
xsk30EgbY2B54Rh3ORm+Z16y/g9TLg/a2fI8dnv0wlUoCCWbNYblI14LL38UdOVcxIy7oY
L0N4szt6UDpuhbBJbqiDb/QsWR4nQyrBxsxYZaEy+1zR8NHuBGHz3HXXmIWv8G2zXrGlKF
WxcU6Wbl9XPdSSlpZQFNGOQ1TiqGH5ovNzPzFWpFw8voeiSkOf/50RdUnyxX+D8P7qVwu3
YAY9j4nS1vN0ECzoAvF3U8r5QsXQyvpQj1uewga65vHUFNbERIRBkmuo9okCHpVnq8cMHc
2JAaxyckHQAAA+A8+bRMPPm0TAAAAAdzc2gtcnNhAAABAQDST/WIbAWSfT79uC1/qJEAYd
/NoKXJsQGPGksAXUogK+SppwCLfrvGyTfQSBtjYHnhGHc5Gb5nXrL+D1MuD9rZ8jx2e/TC
VSgIJZs1huUjXgsvfxR05VzEjLuhgvQ3izO3pQOm6FsEluqINv9CxZHidDKsHGzFhloTL7
XNHw0e4EYfPcddeYha/wbbNesaUoVbFxTpZuX1c91JKWllAU0Y5DVOKoYfmi83M/MVakXD
y+h6JKQ5//nRF1SfLFf4Pw/upXC7dgBj2PidLW83QQLOgC8XdTyvlCxdDK+lCPW57CBrrm
8dQU1sREhEGSa6j2iQIelWerxwwdzYkBrHJyQdAAAAAwEAAQAAAQBxYE2bJ7CxUfedS6ar
hTH2JM1DyvDVFCkk/iWkoqYNRdxVYQQ4LzAHb/44uEabgizyHgBXtfshOrn/oD9VO5Ldn2
rc7OH7yXB1Q+CyMHBiapZZGobqpaMnCj80SKZjMxXEUJ7xYZ1/keQJXqypUFze2Ylfo0s4
CL+STEwTskOeeoqjD8uHaXzT9u6YSd12LqhGqs09mDH1g0YJN+h3hzkIbW+cWZ6SG6SyN+
oymF4f1kJqKhDQw4b6wJV19ZvdMYBWlIKcuQejINCtdfzGu6UOHFTgN7tCc9rvajTjOEi3
1ZvdI08p0zKJ04aEmeYV0u61BgG5HeNmivakYaRM5fxBAAAAgQDCLqyZnlrOjb7r8Zyu92
vR4Gp/H0AqfqL/wkq5mdClNBkAAf/NMQENTc9PL0LRZaNgkCJad4yBrW1UuilNuiNCB1EW
X0oIXmoFVLnp+ICadsjjgodohMJUBjku2gWOQhISp/Ll3ZHGzm92tv0kDfoIhIynShT/Pp
dI3haz/CsvOwAAAIEA8t2s2xeoyuxA/CfP2VntxBkCawtl647WRH0sGjaHz9vzelqM/xUU
SUpkuA2hXisbkLSTpW9DQswmbD+hyFB4+gsl4axjMJkO+FEY7YsO2l870SkupqlftdF0wz
GKaYVjFLIebx2Cqbi3jrrSuvkNj216Y9H/SBgcsIblDyKgE+kAAACBAN2vmahEj8zE3qFO
fPB+AVKLblrTSKxG5fkMdunUPEzaHdB8+bfwWVvNrSgzoh551S31nj+Qm4e+nWdVRfFw7S
i9+Pauh+OwPI+xX7fLd2qbSJOxHYi/kCwmJELmUeYCyDuZzVtN8Mdm7i41ud+IsQP9A38W
5aXKJLVCDus/0jIVAAAAKnJvb3RAdGVzdHZtLTc0d2s2ZDFyNnd1azgtNjk0Njg2NmQ2NS
10ZmJqOA==
-----END OPENSSH PRIVATE KEY-----

Is this SSH Private Key enough to login to the server without any prior configuration?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Victor Taran, 2022-03-24
@shambler81

Public can be created
https://linux-notes.org/sgenerirovat-public-ssh-kl...

R
res2001, 2022-03-24
@res2001

On the client side, its private key is used. The public key is on the server.
Having a private key, you can connect via ssh if the server has a paired public key.
In your case, apparently the public key is on the server in ~/.ssh/authorized_key

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question