在启动脚本中使用 gcsfuse 挂载 gcs 存储桶

问题描述 投票:0回答:2

我想在我的实例启动时安装一个存储桶。我使用的命令是:

gcsfuse --implicit-dirs mybucket /my/folder

当我手动 ssh 进入实例时,这有效。但是,它在启动脚本中失败。日志文件中似乎没有任何错误,但创建的目录有

??????
表示权限、所有者等。使用 Ubuntu 16.04 映像。

对可能发生的事情有什么想法吗?

google-cloud-platform google-cloud-storage gcsfuse
2个回答
0
投票

我能够运行以下命令来使用启动脚本挂载我自己的存储桶,没有 ???????获得许可:

gcsfuse --implicit-dirs --dir-mode "777" -o allow_other -o nonempty MYBUCKET /MY/FOLDER

0
投票

我有一个解决方案可以阻止 ??????权限问题。

首先,确保 /etc/fuse.conf 已取消注释 user_allow_other

通过 CLI:

sudo nano /etc/fuse.conf

或者,通过脚本:

sudo echo "
user_allow_other" >> /etc/fuse.conf

然后为了安装存储桶,我在脚本中使用了此命令

sudo gcsfuse -o allow_other MYBUCKET /MY/FOLDER

在使用 Ubuntu 22.04 时,使用此方法一切正常。

© www.soinside.com 2019 - 2024. All rights reserved.