oezguensi
oezguensi

Reputation: 950

Transfer files to google compute engine instance in jupyter directory

I would like to transfer files from my computer (MacOS) to an instance using gcloud compute scp. I am trying to move the files to the /home/jupyter folder so I can work with them in JupyterLab. But somehow the full command gcloud compute scp ./myPath/myFile instance-name:/home/jupyter gives the error Permission denied.

Also I noticed that when navigating to this folder ~ appears. I think that means it is the actual home directory. So I tried gcloud compute scp ./myPath/myFile instance-name:~/ which works. But now the files were transferred to /home/username which seems to be the real home directory.

Is there a way to navigate back?

Upvotes: 1

Views: 423

Answers (1)

John Hanley
John Hanley

Reputation: 81346

This problem is that you do not have permission to write to the /home/jupyter directory.

Step 1: Add your username to the same group as /home/jupyter. I will assume that the group name is jupyter. You can display the group name with ls -ld /home/jupyter.

sudo usermod -a -G jupyter your_user_name

Step 2: Make sure that the group has write permission:

sudo chmod g+w /home/jupyter

Note the above command only sets group write permission to /home/jupyter. If you want to add write permission to all subdirectores and files of /home/jupyter execute:

sudo chmod -R g+w /home/jupyter

Upvotes: 2

Related Questions