Connect to Oracle Cloud VM with SSH Public-Private Key Pair

https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/managingkeypairs.htm
https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/accessinginstance.htm

  • Generate a local private and public keyfile on the client machine
$ ssh-keygen -o
$ cd .ssh/
$ ls -ltrh
total 12K
-rw-------. 1 opc opc 409 Jan 11 07:05 authorized_keys
-rw-r--r--. 1 opc opc 399 Jan 11 07:19 id_rsa.pub
-rw-------. 1 opc opc 1.8K Jan 11 07:19 id_rsa
$ chmod 400 id_rsa
$ ls -ltrh
total 12K
-rw-------. 1 opc opc 409 Jan 11 07:05 authorized_keys
-rw-r--r--. 1 opc opc 399 Jan 11 07:19 id_rsa.pub
-r--------. 1 opc opc 1.8K Jan 11 07:19 id_rsa
  • Upload ‘id_rsa.pub’ file while creating the instance or paste the ssh keys by pasting contents of public key file
    $ cat id_rsa.pub
  • Connect to the VM from your client machine by using the private key file in .ssh/ directory
ssh -i ~/.ssh/id_rsa opc@10.0.2.3


Category: CloudDatabaseOracle

Tags:

One comment

Leave a Reply

Article by: Shadab Mohammad