GoogleCloudPlatform / gcsfuse

A user-space file system for interacting with Google Cloud Storage
https://cloud.google.com/storage/docs/gcs-fuse
Apache License 2.0
2.05k stars 426 forks source link

systemctl won't access mounted files (permission denied) #340

Closed ThomaciousD closed 2 years ago

ThomaciousD commented 5 years ago

Hi,

I'm trying to run a Squid proxy service whose configuration is located in a GCP bucket mounted with gcsfuse. I'm running into permission issues when the service starts up with systemd.

systemd[1]: Starting Squid caching proxy... cache_swap.sh[21525]: sed: can't read /etc/squid/squid.conf: Permission denied systemd[1]: squid.service: control process exited, code=exited status=1 systemd[1]: Failed to start Squid caching proxy. systemd[1]: Unit squid.service entered failed state. systemd[1]: squid.service failed.

The bucket is mounted in a startup script, but connecting to the instance and mounting manually won't change anything:

sudo -u squid gcsfuse -o nonempty,allow_other --uid ``id -u squid`` --gid ``id -g squid`` squid-config-bucket /etc/squid/

The 'user_allow_other' option is uncommented in /etc/fuse.conf file.

Accessing the conf directory from squid user and root user looks fine:

ls -al /etc drwxr-xr-x. 1 squid squid 0 squid

ls -al /etc/squid/ -rw-r--r--. 1 squid squid 690 cachemgr.conf -rw-r--r--. 1 squid squid 1949 errorpage.css -rw-r--r--. 1 squid squid 19457 mime.conf -rw-r--r--. 1 squid squid 2892 squid.conf

Is there an issue when accessing mounted directories with systemctl ?

I'm using gcsfuse version 0.28.0 (Go version go1.12.1) on CentOS Linux release 7.6.1810 (Core).

surprisetalk commented 5 years ago

Try mounting with --file-mode=0666 and --dir-mode=0777 just to be sure?

Alternatively, you can put the systemd service file in ~/.config/systemd/squid.service of your target user and start the service with systemctl --user start squid.service (no sudo).

avidullu commented 2 years ago

Thanks @surprisetalk for the suggestion here. From the logs I do not see this as a gcsfuse issue. Closing this out for now, please feel free to file a new request/reopen with gcsfuse logs as you see fit.