<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>ssh &#8211; Blog DBA Dutra</title>
	<atom:link href="https://www.dbadutra.com/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbadutra.com</link>
	<description></description>
	<lastBuildDate>Tue, 24 Oct 2023 22:07:43 +0000</lastBuildDate>
	<language>pt-BR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>
<site xmlns="com-wordpress:feed-additions:1">170494511</site>	<item>
		<title>Recovering opc user SSH Key !!</title>
		<link>https://www.dbadutra.com/2023/10/recovering-opc-user-ssh-key/</link>
					<comments>https://www.dbadutra.com/2023/10/recovering-opc-user-ssh-key/#respond</comments>
		
		<dc:creator><![CDATA[André Luiz Dutra Ontalba]]></dc:creator>
		<pubDate>Tue, 24 Oct 2023 22:07:40 +0000</pubDate>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[OCI]]></category>
		<category><![CDATA[recover]]></category>
		<category><![CDATA[ssh]]></category>
		<guid isPermaLink="false">https://www.dbadutra.com/?p=6105</guid>

					<description><![CDATA[Today, I tried to connect to my server on the Oracle Cloud Infrastructure instance, but either I lost my private key or, for some unknown reason, your opc user SSH key got corrupted or deleted. It might be scary at first, but the process of recovering an opc user SSH key on Oracle Cloud Infrastructure [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Today, I tried to connect to my server on the Oracle Cloud Infrastructure instance, but either I lost my private key or, for some unknown reason, your opc user SSH key got corrupted or deleted. It might be scary at first, but the process of recovering an opc user SSH key on Oracle Cloud Infrastructure is easier than you think.</p>



<p></p>



<ol class="wp-block-list">
<li><strong>Stop the instance that you can&#8217;t log in to. </strong></li>
</ol>



<p>Stop the instance that you can’t connect to. In the Oracle Cloud Infrastructure Console, go to the details page for the instance and click <strong>Stop</strong>.</p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-1.png"><img fetchpriority="high" decoding="async" width="975" height="189" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-1.png" alt="" class="wp-image-6106" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-1.png 975w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-1-300x58.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-1-768x149.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></a></figure>



<p></p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-2.png"><img decoding="async" width="975" height="186" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-2.png" alt="" class="wp-image-6107" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-2.png 975w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-2-300x57.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-2-768x147.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></a></figure>



<p></p>



<p>2. <strong>Detach the boot volume.</strong></p>



<p>Detach the boot volume. In the Boot Volume section, click the Actions icon and choose <strong>Detach</strong>. </p>



<figure class="wp-block-image size-full is-resized"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-3.png"><img decoding="async" width="975" height="301" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-3.png" alt="" class="wp-image-6108" style="aspect-ratio:3.2392026578073088;width:840px;height:auto" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-3.png 975w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-3-300x93.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-3-768x237.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></a></figure>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-4.png"><img loading="lazy" decoding="async" width="845" height="169" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-4.png" alt="" class="wp-image-6109" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-4.png 845w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-4-300x60.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-4-768x154.png 768w" sizes="(max-width: 845px) 100vw, 845px" /></a></figure>



<p></p>



<p>3. <strong>Attach the boot volume to a running Linux instance.</strong></p>



<p></p>



<p>Attach the boot volume to another Linux instance by going to Block Storage >> Boot Volumes >> Boot Volumes Details.  Click  <strong>Attach to Instance in Attached Instances</strong>. </p>



<p></p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-5.png"><img loading="lazy" decoding="async" width="975" height="403" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-5.png" alt="" class="wp-image-6110" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-5.png 975w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-5-300x124.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-5-768x317.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></a></figure>



<p>Select the iSCSI, Select Instance and click in <strong>Attach</strong></p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-6.png"><img loading="lazy" decoding="async" width="975" height="663" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-6.png" alt="" class="wp-image-6111" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-6.png 975w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-6-300x204.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-6-768x522.png 768w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-6-90x60.png 90w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-6-95x64.png 95w" sizes="(max-width: 975px) 100vw, 975px" /></a></figure>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-7.png"><img loading="lazy" decoding="async" width="755" height="133" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-7.png" alt="" class="wp-image-6112" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-7.png 755w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-7-300x53.png 300w" sizes="(max-width: 755px) 100vw, 755px" /></a></figure>



<p>Run the iSCSI commands to attach the device and make it visible to the local operating system.</p>



<p></p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-9.png"><img loading="lazy" decoding="async" width="751" height="375" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-9.png" alt="" class="wp-image-6114" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-9.png 751w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-9-300x150.png 300w" sizes="(max-width: 751px) 100vw, 751px" /></a></figure>



<p></p>



<p>Your boot-volume should appear as <strong>/dev/sdb3</strong>.</p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-10.png"><img loading="lazy" decoding="async" width="622" height="644" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-10.png" alt="" class="wp-image-6115" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-10.png 622w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-10-290x300.png 290w" sizes="(max-width: 622px) 100vw, 622px" /></a></figure>



<p></p>



<p>4. <strong>Fix the authorized_keys file.</strong></p>



<p>Make&nbsp;<strong>/dev/sdb3</strong>, which is the root (/) partition where you can recover the opc SSH key file, available to the local operating system using &#8220;mount&#8221; command.</p>



<p></p>



<pre class="wp-block-preformatted">sudo mount  /dev/sdb3 /mnt</pre>



<p></p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-11.png"><img loading="lazy" decoding="async" width="869" height="723" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-11.png" alt="" class="wp-image-6116" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-11.png 869w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-11-300x250.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-11-768x639.png 768w" sizes="(max-width: 869px) 100vw, 869px" /></a></figure>



<p></p>



<p>5. Fix the opc SSH key by editing the <strong>/mnt/home/opc/.ssh/authorized_keys</strong> file and adding your SSH key public file.</p>



<p></p>



<pre class="wp-block-preformatted">sudo vi /mnt/home/opc/.ssh/authorized_keys</pre>



<p></p>



<p>After you add or change the SSH public key you need to use, save, and exit it.</p>



<p></p>



<p>6. <strong>Run umount /mnt.</strong></p>



<pre class="wp-block-preformatted"><code>sudo umount /mnt</code></pre>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-12.png"><img loading="lazy" decoding="async" width="902" height="78" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-12.png" alt="" class="wp-image-6117" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-12.png 902w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-12-300x26.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-12-768x66.png 768w" sizes="(max-width: 902px) 100vw, 902px" /></a></figure>



<p></p>



<p>7. <strong>Detach the iSCSI boot volume by running the detach iSCSI commands</strong>.</p>



<p>Unmount the device and detach it by running the iSCSI commands</p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-13.png"><img loading="lazy" decoding="async" width="975" height="276" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-13.png" alt="" class="wp-image-6118" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-13.png 975w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-13-300x85.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-13-768x217.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></a></figure>



<p>Ensure that the <strong>/dev/sdb</strong> disk is no longer available or visible through the SSH connection, and then detach it.</p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-14.png"><img loading="lazy" decoding="async" width="975" height="171" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-14.png" alt="" class="wp-image-6119" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-14.png 975w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-14-300x53.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-14-768x135.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></a></figure>



<p>Click in <strong>Continue Detachment</strong></p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-15.png"><img loading="lazy" decoding="async" width="975" height="437" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-15.png" alt="" class="wp-image-6120" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-15.png 975w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-15-300x134.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-15-768x344.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></a></figure>



<p>Click in <strong>Detach</strong></p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-16.png"><img loading="lazy" decoding="async" width="975" height="190" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-16.png" alt="" class="wp-image-6121" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-16.png 975w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-16-300x58.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-16-768x150.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></a></figure>



<p></p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-17.png"><img loading="lazy" decoding="async" width="883" height="389" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-17.png" alt="" class="wp-image-6122" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-17.png 883w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-17-300x132.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-17-768x338.png 768w" sizes="(max-width: 883px) 100vw, 883px" /></a></figure>



<p>8. Reattach the boot volume to the instance where you wanted to recover the SSH key, wait for it to become operational.</p>



<p></p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-18.png"><img loading="lazy" decoding="async" width="975" height="442" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-18.png" alt="" class="wp-image-6123" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-18.png 975w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-18-300x136.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-18-768x348.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></a></figure>



<p>Click in <strong>Attach Boot Volume</strong></p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-19.png"><img loading="lazy" decoding="async" width="975" height="106" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-19.png" alt="" class="wp-image-6124" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-19.png 975w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-19-300x33.png 300w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-19-768x83.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></a></figure>



<p>After the boot volume is attached, start the Compute Instance.</p>



<p></p>



<figure class="wp-block-image size-full"><a href="https://www.dbadutra.com/wp-content/uploads/2023/10/image-21.png"><img loading="lazy" decoding="async" width="692" height="380" src="https://www.dbadutra.com/wp-content/uploads/2023/10/image-21.png" alt="" class="wp-image-6126" srcset="https://www.dbadutra.com/wp-content/uploads/2023/10/image-21.png 692w, https://www.dbadutra.com/wp-content/uploads/2023/10/image-21-300x165.png 300w" sizes="(max-width: 692px) 100vw, 692px" /></a></figure>



<p></p>



<p>See you soon in other articles.</p>



<p>Stay tuned by following us on Twitter @aontalba and Linkedin.</p>



<p><strong>Disclaimer: “The postings on this site are my own and do not necessarily represent my current employer positions, strategies, or opinions. The information here was edited to be useful for general purpose, specific data, and identifications was removed to allow reaching a generic audience and to be useful.”</strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbadutra.com/2023/10/recovering-opc-user-ssh-key/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">6105</post-id>	</item>
	</channel>
</rss>
