7

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
gogasca
  • 9,283
  • 6
  • 80
  • 125
srikantrao
  • 188
  • 4
  • 12
  • By default the `jupyter` user has admin privileges, thus it won't require passwords when running commands with sudo. I did try this on my test AI Platform Notebook instance and was able to sudo without being prompt by a password. You might want to check this out for troubleshooting steps. https://stackoverflow.com/questions/43266975/google-cloud-vm-when-sudoing-asks-for-password – Ricco D Apr 08 '21 at 03:06
  • Does this answer your question? [Unable to sudo to Deep Learning Image](https://stackoverflow.com/questions/52753205/unable-to-sudo-to-deep-learning-image) – gogasca Apr 22 '21 at 21:52

2 Answers2

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,proxy-user-mail=user@company.com" \
  --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.

gogasca
  • 9,283
  • 6
  • 80
  • 125
0

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.

kawingkelvin
  • 3,649
  • 2
  • 30
  • 50