googlecloudsdk.core.exceptions.RequiresAdminRightsError:您无法执行此操作,因为您没有权限

时间:2020-05-30 13:33:39

标签: google-cloud-platform google-cloud-sdk

我正在尝试在google-cloud-sdk中安装ubuntu-18.04。我正在关注here给出的官方文档。当我运行./google-cloud-sdk/install.sh时,出现以下错误:-

Welcome to the Google Cloud SDK!

To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. This data is
handled in accordance with our privacy policy
<https://policies.google.com/privacy>. You may choose to opt in this
collection now (by choosing 'Y' at the below prompt), or at any time in the
future by running the following command:

    gcloud config set disable_usage_reporting false

Do you want to help improve the Google Cloud SDK (y/N)?  N

Traceback (most recent call last):
  File "/home/vineet/./google-cloud-sdk/bin/bootstrapping/install.py", line 225, in <module>
    main()
  File "/home/vineet/./google-cloud-sdk/bin/bootstrapping/install.py", line 200, in main
    Prompts(pargs.usage_reporting)
  File "/home/vineet/./google-cloud-sdk/bin/bootstrapping/install.py", line 123, in Prompts
    scope=properties.Scope.INSTALLATION)
  File "/home/vineet/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 2406, in PersistProperty
    config.EnsureSDKWriteAccess()
  File "/home/vineet/google-cloud-sdk/lib/googlecloudsdk/core/config.py", line 198, in EnsureSDKWriteAccess
    raise exceptions.RequiresAdminRightsError(sdk_root)
googlecloudsdk.core.exceptions.RequiresAdminRightsError: You cannot perform this action because you do not have permission to modify the Google Cloud SDK installation directory [/home/vineet/google-cloud-sdk].

Re-run the command with sudo: sudo /home/vineet/google-cloud-sdk/bin/gcloud ...

我试图在stackoverflow和github-issues上进行搜索,但徒劳无功。

希望能得到解决的任何提示。

1 个答案:

答案 0 :(得分:0)

如错误消息中所述。

使用sudo重新运行命令:sudo / home / vineet / google-cloud-sdk / bin / gcloud ...

install.sh脚本应使用sudo运行。

还有其他替代方法可以在Ubuntu 18.04中安装Google Cloud SDK,就像documentation中所述使用apt-get安装软件包一样。