A
A
alisherchikkk2021-11-23 08:04:13
linux
alisherchikkk, 2021-11-23 08:04:13

How to connect via ssh with a ready private key in ubuntu?

Good afternoon! You need to connect to virtual servers. I use ubuntu, gave out a private_key file for the user under which you need to log in. How can you use this key?

Connected usually like this - ssh [email protected]

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Karabanov, 2021-11-23
@alisherchikkk

issued a private_key file

Sounds scary. The private key must not leave the machine on which it was generated. If the key was issued, then it is automatically compromised.
You had to generate a pair of keys for yourself and transfer the public key to the admins, and they would add it to the servers. I recommend that you run away from this kindergarten as soon as possible.
To connect using a key, explicitly specify it using the flag -i, see details in man ssh.
You can also place the private key in ~/.ssha name corresponding to the type of key, then it will not be necessary to explicitly specify it, the details are in the same place man ssh.
You can also write the appropriate settings in ~/.ssh/config.
PS
Magic SSH
Reminder to ssh users

A
Alexander, 2021-11-23
@Adler_lug

ssh -i <путь к к файлу ключа> [email protected]
Googling in 10 seconds...

B
BorLaze, 2021-11-23
@BorLaze

Add to ~/.ssh/config

Host host_alias
  HostName host_ip
  User user
  IdentityFile ~/.ssh/id_rsa

After that, you can log in to the host by simply typing the command ssh host_aliasinstead ofssh [email protected]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question