SSH is the standard on live command-line based access to Linux systems. Oracle Linux Tips and Tricks: Using SSH is a good initial read.
While an Oracle Cloud Infrastructure (OCI) instance is being created, a public SSH key is needed to be provided in the web interface to provide password-less SSH access to the new instance.
The question is "How to produce the public SSH key needed?". This post aims to help the reader to achieve that objective on a Linux command-line.
On Linux command line, the ssh-keygen command is used to generate the necessary public key.
Open a terminal in your Linux desktop GUI and make sure that you are logged on the user account (e.g. my_user - avoid using root account for general security reasons) that you would use to access the new Oracle Cloud Infrastructure instance via SSH
$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/my_user/.ssh/id_rsa):
Give a name to your key pair to be generated (e.g. my_ssh_key)
Enter file in which to save the key (/home/my_user/.ssh/id_rsa): my_ssh_key Enter passphrase (empty for no passphrase):
Do not provide any passphrase and skip with enter.
Enter same passphrase again: Your identification has been saved in my_ssh_key. Your public key has been saved in my_ssh_key.pub. The key fingerprint is: SHA256:tXpJNaug8iUdIEVCM+7WHX8gqS/AfRi//tUKanA1Eo8 my_user@my_desktop The key's randomart image is: +---[RSA 2048]----+ | .=.o | | . = .. | | o o ++o o | | o + BE=++ o | | = = So+.o | | . ..=.* + . | | . +o* = . . | | o =.o o . | | ..o.. . | +----[SHA256]-----+
The file my_ssh_key.pub would have been created in your home directory.
$ cat my_ssh_key.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkDBM0WOv+AzboCPaqhr8cAN/G HBoclnR+Gvo9x4JZA9gPYQIhCgGet4E8YgcWLwa0tDrZJvg/DuVMfQ0oA2JiaWHN W54lrfuACJVdF/8wZGKpgK5vnd7/pcAIZ9r6rdeaDyFSMEscNwX3pjEnkMp92ykQ tO4rmxnHtqefsvh+O4i4DT4EQE0bUanLriYs59K1XMkA2bIUvnjjD7ILKyNqVeYK hu5w/iS72+9l0U6nfifbyzy4VbqtOI1uU8bvdqeL7J6okTQjeJl/fW2tha//pNbm /nTVyLOOdYXxmAZ8zXX7r6X4pZE5lmbmowk3AZTojlI7MTrYOKuQcxsusUJ my_u ser@my_desktop
While creating the Oracle Cloud Infrastructure instance, in the "Add SSH Keys" section, choose "PASTE PUBLIC KEYS" and copy/paste the contents of the public key file (alternatively you ca upload the file too)
After the instance is created, use ssh command with the private key to access it (where <ip_addr> is the IP address of the new Oracle Cloud Infrastructure instance:
$ ssh -i my_ssh_key opc@<ip_addr> The authenticity of host '<ip_addr>(<ip_addr>)' can't be established. ECDSA key fingerprint is SHA256:qD2zZE5hO0TYYEMQdDpSPz5izTuaFslwZiMOZp7kwDc. ECDSA key fingerprint is MD5:ea:c3:e8:61:e9:29:7a:df:ae:b6:43:ad:5b:71:f7:90. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '<ip_addr>' (ECDSA) to the list of known hosts. [opc@<ip_addr> ~]$
To be able to access an Oracle Cloud Infrastructure instance via ssh on a Linux desktop, one can use the ssh-keygen command to generate the necessary SSH key pair and add relevant information on the Oracle Cloud Infrastructure instance as described.