google-cloud-platform - 如何在 GCP 中获得对 AI Platform notebook 的 root 访问权限?
问题描述
我jupyter
在 GCP AI Platform 笔记本实例的终端中以用户身份登录。
我只想安装一些东西(不能通过 pip 安装)并且我无法使用 gcloud 命令以 root 用户身份进行 ssh。
如果有人可以分享正确方法的指针来获得执行这些操作的权限,那就太好了。
这是导致问题的示例包安装的片段 -
(base)~/datascience$ sudo cp ./pip-bash-completion/pip /etc/bash_completion.d/
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for jupyter:
sudo
根据我看到的信息,我应该可以访问 -
Zone - us-central1-b
Environment - Python 3 (with Intel® MKL)
Machine type - n1-standard-4 (4 vCPUs, 15 GB RAM)
GPU - None
Boot disk - 100 GB disk
Data disk - 100 GB disk
Backup - Not specified
Permission mode - Service account
Sudo access - Enabled
解决方案
如果你在 Jupyter 终端,你应该使用sudo
. 一些 IT 管理员使用notebook-disable-root=true
元数据来限制 root 访问。您可以通过访问 Cloud Console 中的笔记本页面来验证这一点。
创建禁用 root 的新实例的示例:
gcloud notebooks instances create $INSTANCE_NAME \
--vm-image-project=deeplearning-platform-release \
--vm-image-family=tf-latest-gpu \
--metadata="notebook-disable-root=true,proxy-mode=mail,proxy-user-mail=user@company.com" \
--location=us-west1-a
Google Cloud AI Platform Notebooks 通过 OSLogin 支持 SSH。https://cloud.google.com/compute/docs/oslogin/manage-oslogin-in-an-org 您需要使用您的 IAM 帐户进行 SSH,然后执行 sudo。
推荐阅读
- linux - 'find' 命令给出:shell 脚本中没有这样的文件或目录错误
- delphi - 如何像 Office 一样在 Delphi 中编写“子”应用程序?
- regex - 正则表达式验证字符串的前后斜杠
- python - 有没有一种使用内部元素很少的多个数据框进行预测的方法?
- android - 如何解决这个 android 模拟器错误的大小调整?我正在使用 vscode 但模拟器显示如下
- java - 使用 Java 将 JSON 转换为 POJO 并赋值
- go - gorm 与 foreignKey 参考有很多关系
- docker - 在 Docker 容器下的 GStreamer 管道之间共享内存
- python - 维度不匹配的数量 - Tensorflow
- typescript - 如何调用从父类继承的异步函数?