Cannot connect to code-server in GCP - Permission denied (publickey)

200 Views Asked by At

I am attempting to install and access vscode in an instance of Compute Engine of GCP using the instructions on Coder.1

I have also been going through their instructions on exposing code-server using SSH2, however, when I try and run the command ssh -N -L 8080:127.0.0.1:8080 [user]@<instance-ip> swapping out [user] and ip address, I get the following:

The authenticity of host 'ip address (ip address)' can't be established.
ECDSA key fingerprint is SHA256:"hash".
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ipaddress' (ECDSA) to the list of known hosts.
[user]@<instance-ip>: Permission denied (publickey).

Code server should be running as when trying to execute I get:

info  code-server 4.9.1
info  Using user-data-dir ~/.local/share/code-server
error listen EADDRINUSE: address already in use 127.0.0.1:8080

Attempting to login using http:\\127.0.0.1:80 on Firefox making sure Don’t enable HTTPS-Only Mode is on, page cannot be found.

Admittedly, I have little experience with Linux and SSH.

Any way I can troubleshoot this?

1

There are 1 best solutions below

2
On

Permission denied: states that you are not authorized to use SSH to access the remote server. You should make sure that the private key for your SSH keychain has been added to your SSH keychain and that the SSH public key for your user account has been uploaded to the server in order to resolve this issue. When running the ssh command, you can also try specifying the path to your private key file by using the -i flag. For instance:

ssh -i /path/to/private_key [user]@<instance-ip>

ssh -i /path/to/private_key -N -L 8080:127.0.0.1:8080 [user]@instance-ip> 

If the private key file is protected by a passphrase, you will also need to provide the correct passphrase and the -p flag.

Attaching a troubleshooting doc for reference.