login to a linux server on your local machine from which you want to esatablish the connection.
Generate public and private rsa
[root@oel6-node01 ~]# ssh-keygen -t rsa -N "" -b "2048" -C "key comment" -f /tmp/oci_rsa_key Generating public/private rsa key pair. Your identification has been saved in /tmp/oci_rsa_key. Your public key has been saved in /tmp/oci_rsa_key.pub. The key fingerprint is: 56:85:6a:80:f7:5f:68:db:39:5f:00:70:56:a9:11:ce key comment The key's randomart image is: +--[ RSA 2048]----+ | . .o=o.. | | . o .*o . | | . o ...E+ | | +.o o . | | .So + . . | | . o + .| | o . | | . | | | +-----------------+ [root@oel6-node01 ~]# cd /tmp [root@oel6-node01 tmp]# ls -ltr oci* -rw-r--r--. 1 root root 393 May 26 17:06 oci_rsa_key.pub -rw-------. 1 root root 1675 May 26 17:06 oci_rsa_key [root@oel6-node01 tmp]#
create a compute instance on OCI
login to oci and click on instance
click on create instance
provide inputs as needed
in this step provide the public key which was generated above. i copied the public key on my windows maching and selected the it by clicking on browse option.
click create and your instance will start provisioning
once created status will change to running
note down the public ip address it will be used to connect to this machine
Now connect to this compute instance by providing private key generated above. note the user we are using to connect is “opc”
[root@oel6-node01 ~]# ssh -i /tmp/oci_rsa_key email@example.com The authenticity of host '22.214.171.124 (126.96.36.199)' can't be established. RSA key fingerprint is 93:a9:be:28:0a:3e:a3:93:58:26:42:b9:7e:12:45:50. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '188.8.131.52' (RSA) to the list of known hosts.
you are now connected to the compute instance. verify the details
[opc@oel7-comp01 ~]$ uname -a Linux oel7-comp01 4.14.35-1902.301.1.el7uek.x86_64 #2 SMP Tue Mar 31 16:50:32 PDT 2020 x86_64 x86_64 x86_64 GNU/Linux [opc@oel7-comp01 ~]$ hostname oel7-comp01 [opc@oel7-comp01 ~]$ df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 458M 0 458M 0% /dev tmpfs 486M 0 486M 0% /dev/shm tmpfs 486M 13M 473M 3% /run tmpfs 486M 0 486M 0% /sys/fs/cgroup /dev/sda3 39G 2.0G 37G 6% / /dev/sda1 200M 9.7M 191M 5% /boot/efi tmpfs 98M 0 98M 0% /run/user/1000
you can switch to root user as well
[opc@oel7-comp01 ~]$ sudo su - Last failed login: Tue May 26 13:19:39 GMT 2020 on pts/1 There was 1 failed login attempt since the last successful login. [root@oel7-comp01 ~]# id uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
to copy file to compute instance
create a file on local server
[root@oel6-node01 tmp]# touch 111 [root@oel6-node01 tmp]# vi 111 [root@oel6-node01 tmp]# cat 111 second file
user secure copy
[root@oel6-node01 tmp]# scp -i /tmp/oci_rsa_key 111 firstname.lastname@example.org:/tmp 111 100% 12 0.0KB/s 00:00
verify the file on compute instance
[root@oel6-node01 tmp]# ssh -i /tmp/oci_rsa_key email@example.com Last login: Tue May 26 13:35:54 2020 from 184.108.40.206 [opc@oel7-comp01 ~]$ cd /tmp [opc@oel7-comp01 tmp]$ cat 111 second file [opc@oel7-comp01 tmp]$