rsync ssh文件复制到GCE实例失败,权限被拒绝

时间:2015-02-20 13:26:40

标签: ssh rsync google-compute-engine

我正在我的本地计算机上执行以下操作,该计算机通过Google Cloud SDK在Google Compute Engine中使用我的项目进行身份验证:

rsync -avu --omit-dir-times -e ssh \
    -o UserKnownHostsFile=/dev/null \
    -o CheckHostIP=no -o StrictHostKeyChecking=no \
    -i /home/fredrik/.ssh/google_compute_engine \
    /somefolder/hello.txt \
    1.2.3.4:/mymount/

...其中1.2.3.4是我的GCE实例的公共IP,我收到以下错误:

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(600) [sender=3.0.6]

我执行命令的机器已经过身份验证,例如,可以成功执行gcloud compute ssh instance-1以便SSH进入同一个实例。

为了成功执行rsync命令,我需要做什么?

1 个答案:

答案 0 :(得分:3)

围绕-e的行情解决了它:

rsync -avu --omit-dir-times -e "ssh -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -i /home/fredrik/.ssh/google_compute_engine" /somefolder/hello.txt 1.2.3.4:/mymount/