'How do I get root access to AI Platform notebook within GCP?
I am logged as user jupyter
in the terminal in my GCP AI Platform notebook instance.
I want to just install a few things (cannot be installed by pip) and I am unable to ssh as root user using the gcloud command.
It would be great if someone could share a pointer of the right way to get permissions to perform these actions.
Here is a snippet of an example package installation that is causing problems -
(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:
I am supposed to have sudo
access based on the information I see -
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
Solution 1:[1]
If you are in the Jupyter Terminal you should use sudo
.
Some IT admins restrict root access by using the notebook-disable-root=true
metadata. You can verify this by accessing the Notebooks page in Cloud Console.
Example of creating a new instance with root disabled:
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,[email protected]" \
--location=us-west1-a
Google Cloud AI Platform Notebooks support SSH via OSLogin. https://cloud.google.com/compute/docs/oslogin/manage-oslogin-in-an-org you need to SSH with your IAM account and then perform a sudo.
Solution 2:[2]
I recently created some new AI Notebook instance, and without any fancy taking most defaults, i am able to sudo as Jupyter. I used the terminal inside the jupyterlab.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | kawingkelvin |