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

rsync ssh file copying to GCE instance fails with permission denied

我正在我的本地机器上执行以下操作,该机器通过 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 实例的 public 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命令?

-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/