krlaboratories

How recovery SSH keys on VPS in Oracle Cloud

Feb 10th, 2022 (edited)
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.08 KB | None | 0 0
  1. 0. Create new instance with SSH keys.
  2.  
  3. 1. Stop current instance and go to the 'Boot volume' -> Detach current Boot Volume.
  4.  
  5. 3. Go to the Second instance and go to the 'Attach block volunes' and Attach Boot Volume of first instance.
  6.  
  7. 4. Connect through SSH, sudo su and run commands from 'iSCSI commands & information' ('Attached Blocked volume').
  8.  
  9. 5. Check new Volumes:
  10.  
  11. lsblk
  12. fdisk -l /dev/sdb
  13.  
  14. 6. Mount new Volume:
  15.  
  16. sudo mount -t ext4 /dev/sdb1 /mnt
  17.  
  18. 7. Check mounted volume:
  19.  
  20. df -h
  21.  
  22. 8. Open /user/.ssh/authorized_keys and update SSH-keys or add new. Save.
  23.  
  24. 9. Unmount volume:
  25.  
  26. sudo umount /mnt
  27.  
  28. 10. Detach iSCSI by runing detach commands from 'iSCSI commands & information' ('Attached Blocked volume').
  29.  
  30. 11. exit SSH
  31.  
  32. 12. Detach volume in Oracle Instance Details view -> Attached Block Volumes
  33.  
  34. 13. Go to the first instance -> 'Boot Volume' and attach again native Volume.
  35.  
  36. 14. Start instance.
  37.  
  38. 15. Connect via new SSH keys
  39.  
  40. PROFIT.
  41.  
  42. Reference: https://blogs.oracle.com/cloud-infrastructure/post/recovering-opc-user-ssh-key-on-oracle-cloud-infrastructure
  43.  
Add Comment
Please, Sign In to add comment