Error MessageServer refused our key when $ gcloud compute copy-files is executed

5,179 views
Skip to first unread message

Pablo Leon

unread,
Oct 2, 2015, 10:51:14 PM10/2/15
to gce-discussion
I am trying to copy files to my virtual machine to my local machine. I am following the steps from this link http://googlecloudplatform.blogspot.com/2014/06/achieve-more-with-new-google-compute.html

but I get the following error message from the Google Cloud SDK Shell:

Server refused our key
Fatal: Disconnected: No supported authentication methods available (server sent:
 publickey)
ERROR: (gcloud.compute.copy-files) [C:\Program Files (x86)\Google\Cloud SDK\goog
le-cloud-sdk\bin\sdk\scp.EXE] exited with return code [1]. See https://cloud.google.com/compute/docs/troubleshooting#ssherrors for troubleshooting hints.


Do you known what is the problem?

Thanks in advance.

Kamran (Google Cloud Support)

unread,
Oct 3, 2015, 6:39:33 PM10/3/15
to gce-discussion

Hi Pablo,

To resolve this issue, make a backup of the key files located in "C:\Users\<username>\.ssh" folder and then remove them to make the folder empty. Then try your command (gcloud compute copy-files .....) again to generate a valid key pair.

Sincerely,

Pablo Leon

unread,
Oct 3, 2015, 9:01:11 PM10/3/15
to Kamran (Google Cloud Support), gce-discussion
Hello, thanks for your answer. 

I followed your instructions but after execute the "copy files" command i get the following error:

Imágenes integradas 1


Best Regards, 


--
© 2014 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-dis...@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.
---
You received this message because you are subscribed to a topic in the Google Groups "gce-discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gce-discussion/1-0nwPVE_PI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gce-discussio...@googlegroups.com.
To post to this group, send email to gce-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gce-discussion/8784f51f-5a76-490c-aba1-e109591b5760%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Saludos Cordiales,

--------------------
Pablo Leon M.

Kamran (Google Cloud Support)

unread,
Oct 4, 2015, 4:16:45 PM10/4/15
to gce-discussion, khas...@google.com

Hey Pablo,

The command tries to use your Windows username 'pablo.leon' to SSH to the VM instance. This issue can happen if the user is no allowed to connect to the VM via SSH (e.g. the username is not listed front of AllowUsers in /etc/ssh/sshd_config). 

Try your command with a username that is allowed to SSH to the VM and at least has read permission to the files you want to copy. For example if 'pablojlm5' username is permitted to SSH to your VM then try this command:

$ gcloud compute copy-files pablojlm5@bitnami-wordpress-a967:/home/pablojlm5/dbBackup.sql dbBackup.sql --zone us-central1-a


Sincerely,




On Saturday, October 3, 2015 at 9:01:11 PM UTC-4, Pablo Leon wrote:
Hello, thanks for your answer. 

I followed your instructions but after execute the "copy files" command i get the following error:

Imágenes integradas 1


Best Regards, 

2015-10-03 16:39 GMT-06:00 Kamran (Google Cloud Support) <khas...@google.com>:

Hi Pablo,

To resolve this issue, make a backup of the key files located in "C:\Users\<username>\.ssh" folder and then remove them to make the folder empty. Then try your command (gcloud compute copy-files .....) again to generate a valid key pair.

Sincerely,



On Friday, October 2, 2015 at 10:51:14 PM UTC-4, Pablo Leon wrote:
I am trying to copy files to my virtual machine to my local machine. I am following the steps from this link http://googlecloudplatform.blogspot.com/2014/06/achieve-more-with-new-google-compute.html

but I get the following error message from the Google Cloud SDK Shell:

Server refused our key
Fatal: Disconnected: No supported authentication methods available (server sent:
 publickey)
ERROR: (gcloud.compute.copy-files) [C:\Program Files (x86)\Google\Cloud SDK\goog
le-cloud-sdk\bin\sdk\scp.EXE] exited with return code [1]. See https://cloud.google.com/compute/docs/troubleshooting#ssherrors for troubleshooting hints.


Do you known what is the problem?

Thanks in advance.

--
© 2014 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-discussion@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.

---
You received this message because you are subscribed to a topic in the Google Groups "gce-discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gce-discussion/1-0nwPVE_PI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gce-discussion+unsubscribe@googlegroups.com.
To post to this group, send email to gce-discussion@googlegroups.com.

Pablo Leon

unread,
Oct 11, 2015, 12:26:26 PM10/11/15
to gce-discussion, khas...@google.com
I had added the user to /etc/ssh/sshd_config and then executes the commands, but i get the initial error:

Server refused our key
Fatal: Disconnected: No supported authentication methods available (server sent:
 publickey)
ERROR: (gcloud.compute.copy-files) [C:\Program Files (x86)\Google\Cloud SDK\goog
le-cloud-sdk\bin\sdk\scp.exe] exited with return code [1]. See https://cloud.goo

Maybe this other information can help. This are my steps:

1. I am executing the command 
$ gcloud auth login
Then a browser is open in order to request my gmail credentials. Now i am logged with my gmail account user. FYI:pablo.leon is the OS user from my local windows machine.
2.Then I execute the  command: 
$ gcloud compute copy-files pablojlm5@bitnami-wordpress-a967:/home/pablojlm5/dbBackup.sql dbBackup.sql --zone us-central1-a
3. I get the Server refused our key error. 


Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-dis...@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.

---
You received this message because you are subscribed to a topic in the Google Groups "gce-discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gce-discussion/1-0nwPVE_PI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gce-discussio...@googlegroups.com.
To post to this group, send email to gce-dis...@googlegroups.com.

Pablo Leon

unread,
Oct 11, 2015, 3:44:15 PM10/11/15
to gce-discussion, khas...@google.com
I resolved the problem following the following steps:

1. Go to files located in "C:\Users\<username>\.ssh" folder and then remove the google_compute_engine files. 

2.Open the Google Cloud SDK Shell and type the command:
gcloud auth login
and login with you gmail account associated to google cloud. After that, allow access when request it.

3. Then try command
gcloud compute copy-files <username>@bitnami-wordpress-a967:~/home/user/FileToDownload.txt FileToDownload.txt --zone us-central1-a
notes:
- <username> is the user name from C:\Users\<username>\.ssh
-the Shell will generate the keys. Type a passphrase when request it. 
-Ignore the FATAL ERRORS
-Make sure that use ~ char as VM path prefix in the command copy-files

4.Then go to "C:\Users\<username>\.ssh" and opens the google_compute_engine.pub file. Copy the content and go to https://console.developers.google.com at Compute->Compute Engine->VM Instances and click your instance and select edit option

5. Then go to SSH Kesy and add a item. Then paste the copied content in step 4. Click Save.

6.Finally go to SDK and try again step 3. 

It works for me. Thak you ver much for your support.

Kamran (Google Cloud Support)

unread,
Oct 11, 2015, 8:12:58 PM10/11/15
to gce-discussion, khas...@google.com

The gcloud command tool should take care of the steps 4 and 5 you listed and will automatically add the generated public key to the Compute Engine's metadata (On the Developers Console > Compute > Compute Engine > Metadata > SSH Keys). This will make the generated public key available to all VM instances. 

Please make sure you're authenticated the gcloud command (gcloud auth login) using an account that has edit or ownership to the project. Also try to update your Google Cloud SDK to latest version, if you have not already done so.

Sincerely,

Kamran

Peter Coghill

unread,
Feb 15, 2016, 3:05:59 PM2/15/16
to gce-discussion, khas...@google.com
Hi Kamran,

I'm doing everything that you suggest here, and following the steps suggested by Pablo (thanks for the posts) but with no luck.  I've tried removing the local keys C:\User\<username>\.ssh and those in GCE meta options. I've even reinstalled Gcloud sdk!  But nothing seems to fix the "Server refused our key" problem.  

I have no problem connecting to the VM via the GCE Console. The VM is up and i can work on it directly, but trying to connect via window cmd (using gcloud compute ssh <instance>) or FTP, or PuTTY just wont work!  I'm pulling my hair out...

Any thoughts welcomed...  

Peter Coghill

unread,
Feb 15, 2016, 4:31:04 PM2/15/16
to gce-discussion, khas...@google.com
I also tried setting up a ssh connection from another GCE ubuntu VM having authenticated using 
gcloud init
to authenticate via a url and authentication code. No luck there either.

It seems (as with windows) to generate the keys ok, but then when it tries to connect it gets "Permission denied (publickey)" 
Reply all
Reply to author
Forward
0 new messages