Score:0

Can no longer use private key to SSH into Oracle Cloud server

ch flag

This started yesterday after I attempted to execute an SCP command to send a tarball file I had created on my VM to my local machine, it came up with a text block informing me that the address was unknown along with the ECDSA fingerprint for the server followed by asking me if I wanted to continue with 3 options it wished for me to enter, yes, no, the fingerprint, I entered in yes, it added the IP address of my virtual server to a list of known hosts, I never received the tarball file because it then gave me this output: username@ip address: Permission denied (publickey) and from that point, when I attempt to SSH into my virtual server I receive the following output: Load key "/path/to/.ssh/private key": Permission denied username@ip address: Permission denied (publickey)

I know it is related to something changing the permissions for the private key because when I try to access the file it says I cannot read the file, I have been unable to change the permissions using sudo chmod 600 from the command line, the command appears to execute only for it to have done nothing at all to the file in question, because of this I am effectively locked out of my virtual server, I need to figure out how to change the permissions back to what they were so my public key can actually read the file and confirm it matches up with itself so I can be granted access to my server.

Score:0
pl flag

Sounds like wonky permissions on your local ssh configuration. To fix your local ssh key permissions:

chown -R $USER ~/.ssh
chmod 700 ~/.ssh 
chmod 600 ~/.ssh/id_rsa ~/.ssh/authorized_keys ~/.ssh/known_hosts
chmod 644 ~/.ssh/id_rsa.pub ~/.ssh/config

All should be right again.

oraclewoes avatar
ch flag
Thank you, just a couple qs, I'm still somewhat new to operating with a CLI and want to make sure I get this right, should id_rsa be entered in exactly as written above in your answer or do I need to substitute in something specific there, also for $USER would this be the username I use (I should have mentioned I'm using Ubuntu 18.04) for Ubuntu, thanks again for your answer, just want to make sure I understand it fully.
oraclewoes avatar
ch flag
I should have also mentioned this because I realize it may be relevant, when I created my keys for my VM I just generated a keypair on the Oracle Cloud website and downloaded and saved my private key while the public key just remained on my Oracle Cloud server, I only have the private key stored on my computer, apologies for not mentioning that before, I only realized just now that that might be a significant thing to mention
oraclewoes avatar
ch flag
Ok I just ran the first 3 commands you said, modifying as needed to suit my particular situation and that actually fixed my problem completely, thanks for the help, I was close to tearing my hair out, very much appreciated!
oraclewoes avatar
ch flag
Actually, I still can't transfer the tarball from the VM to my local machine, located the authorised_keys in my VM but when I try to change the permissions it says: chmod: cannot access '/home/remote_username/.ssh/authorised_keys': No such file or directory, it appears to think I'm trying to get at a file in a directory that's different from the one I'm trying to access, I'm not going for the folder that is named for remote_username I;m going for a folder called OCP, not sure how to get the VM to recognize that
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.