MallocArray / obico-oraclecloud

Self Hosted Obico server on Oracle Cloud Free Tier
55 stars 3 forks source link

SSH not working #2

Closed timur-tabi closed 2 years ago

timur-tabi commented 2 years ago

I followed the instructions to set up SSH, but I still cannot connect:

$ ssh -i ~/.ssh/id_rsa ubuntu@129.146.185.70 ubuntu@129.146.185.70: Permission denied (publickey).

I'm positive I have entered the correct RSA public key into the ssh_public_key variable of the stack, but it doesn't appear to be taking effect.

The instructions say to enter the info under "Resources>Console Connections" but I can't find that menu.

timur-tabi commented 2 years ago

I know SSH is up and running:

$ nc 129.146.185.70 22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5

timur-tabi commented 2 years ago

I found the Connections page:

Compute->Instances, and changed the Compartment to "obico" Select the instance name (obico-39341) Select "Console connection"

However, at this point I'm stuck. I don't see any option for entering an ssh key.

timur-tabi commented 2 years ago

Also, when I create a Cloud Shell, I cannot figure out what to use for the userid and password. Nothing I've tried works.

MallocArray commented 2 years ago

I've never gotten it to work with Cloud Shell, as only SSH auth is enabled for the Ubuntu image. I'm certain the ssh_public_key variable is used correctly as that is how I get into the Instance on my personal install that I built using the latest instructions. When I did it, I used the Putty Key Generator section of: https://docs.oracle.com/en-us/iaas/Content/Compute/Tasks/managingkeypairs.htm

The trick that I don't think is specified in that article is that once you have your key pair generated with puttygen.exe, you will use the public key in the stack variable as you already did, but in the Putty.exe connection, you need to go to Connection>SSH>Auth and give it the location for the "Private key file for authentication" area. Then, just as you did, make sure hostname contains the username ubuntu, such as ubuntu@1.2.3.4

I'll have to take another look at the Resources>Console Connections section. There used to be a place to enter the public key after an instance was provisioned, but I haven't used that.

timur-tabi commented 2 years ago

There is a place to put the public key in Console Connection, but it doesn't appear to do anything.

It seems that if you don't associate a public key when you run the stack, you will never be able to ssh in.

MallocArray commented 2 years ago

It may be one of the features that only works fully if you are using an Oracle Linux image, as I've found a few like that. By entering the public key in the stack variables and doing a Destroy/Apply, you are able to get in?

If so, can we close this issue and I'll update the Readme to remove the mention of the Console Connection area

timur-tabi commented 2 years ago

Yes, recreating the stack with the public key does work. So I think you should change the instructions to make that clear, and encourage people to specify a public key if they have one already.

TylonHH commented 2 years ago

Then, just as you did, make sure hostname contains the username ubuntu, such as ubuntu@1.2.3.4

THAT have to mentioned in the readme also. Now it works for me too.