2017-09-23 93 views
0

我可以使用Web控制檯在我的實例上運行此命令;爲什麼GCE上的命令在控制檯終端上工作,但不能作爲Cron作業

的rsync的gsutil -d -r /我的路徑GS://我鬥

但是當我嘗試我的SSH遠程終端上我得到這個錯誤;

[email protected]: gsutil rsync -d -r /my-path gs://my-bucket 
Building synchronization state... 
INFO 0923 12:48:48.572446 multistore_file.py] Error decoding credential, skipping 
    Traceback (most recent call last): 
     File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/oauth2client/oauth2client/multistore_file.py", line 381, in _refresh_data_cache 
     (key, credential) = self._decode_credential_from_json(cred_entry) 
     File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/oauth2client/oauth2client/multistore_file.py", line 400, in _decode_credential_from_json 
     credential = Credentials.new_from_json(json.dumps(cred_entry['credential'])) 
     File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/oauth2client/oauth2client/client.py", line 292, in new_from_json 
     return from_json(s) 
     File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/apitools/apitools/base/py/credentials_lib.py", line 356, in from_json 
     data['token_expiry'], oauth2client.client.EXPIRY_FORMAT) 
    TypeError: must be string, not None 
    Caught non-retryable exception while listing gs://my-bucket/: Could not reach metadata service: Not Found 
    At source listing 10000... 
    At source listing 20000... 
    At source listing 30000... 
    At source listing 40000... 
    CommandException: Caught non-retryable exception - aborting rsync 
+0

您需要確保分配給該實例的服務帳戶具有允許其寫入存儲桶的IAM權限。 – danemacmillan

回答

2

我通過將用戶切換到創建項目時創建的默認CGE來解決此問題。虛擬機上的根目錄沒有權限運行gsutil命令。

相關問題