将文件传输到jupyter目录中的Google计算引擎实例

时间:2019-01-26 00:47:00

标签: google-cloud-platform google-compute-engine

我想使用gcloud compute scp将文件从计算机(MacOS)传输到实例。我试图将文件移动到/home/jupyter文件夹中,以便可以在JupyterLab中使用它们。但是以某种方式,完整的命令gcloud compute scp ./myPath/myFile instance-name:/home/jupyter给出了错误Permission denied

我还注意到,导航到此文件夹~时会出现。我认为这就是实际的主目录。因此,我尝试了gcloud compute scp ./myPath/myFile instance-name:~/可行的方法。但是现在文件已传输到/home/username,这似乎是真实的主目录。

是否有导航的方法?

1 个答案:

答案 0 :(得分:1)

此问题是您无权写入/home/jupyter目录。

步骤1:将您的用户名添加到/home/jupyter所在的组中。我将假定组名称为jupyter。您可以使用ls -ld /home/jupyter显示组名。

sudo usermod -a -G jupyter your_user_name

第2步:确保该组具有写权限:

sudo chmod g+w /home/jupyter

请注意,以上命令仅将组写入权限设置为/home/jupyter。如果要为/home/jupyter的所有子目录和文件添加写权限,请执行:

sudo chmod -R g+w /home/jupyter