Ubuntu 18.04挂载Digital Ocean存储后进入目录提示‘Operation not allowed’求助
Let's break down the issues from your logs and resolve them step by step:
Key Observations from Logs
- The warning
contents_xp->nodesetval is emptyindicates s3fs couldn't list the bucket contents (either the bucket is empty, or there's a communication/permissions issue). - The repeated
s3fs_accesschecks forX_OK(execute permission) on/minimoj-consumerpoint to a permission or mount configuration problem.
Step 1: Secure Your .passwd-s3fs File
s3fs requires strict permissions on the credentials file to prevent unauthorized access. Run this command to set the correct permissions:
chmod 600 /home/ivan/hosts/docker-symfony/symfony/.passwd-s3fs
Step 2: Fix Mount Command for Digital Ocean Spaces
Digital Ocean Spaces uses path-style request formatting, which isn't enabled by default in s3fs. Additionally, you need to ensure the mount point is accessible by your user.
First, unmount the current broken mount:
fusermount -u /home/ivan/hosts/docker-symfony/symfony/do1
Then remount with the corrected options:
s3fs minimoj-consumer /home/ivan/hosts/docker-symfony/symfony/do1 \ -o passwd_file=/home/ivan/hosts/docker-symfony/symfony/.passwd-s3fs \ -o url=https://ams3.digitaloceanspaces.com \ -o use_path_request_style \ -o uid=$(id -u ivan) \ -o gid=$(id -g ivan) \ -o dbglevel=info -f -o curldbg
What these options do:
use_path_request_style: Forces s3fs to use path-style URLs (required for Digital Ocean Spaces).uid/gid: Sets the owner of the mount point to your user (ivan), so you can read/write without root privileges.
Step 3: Verify Credentials and Bucket Permissions
Test if your credentials have access to the bucket using curl:
curl -u YOUR_ACCESS_KEY:YOUR_SECRET_KEY https://ams3.digitaloceanspaces.com/minimoj-consumer/
- If this returns an XML listing (even empty), your credentials are valid.
- If you get an error, log into Digital Ocean's control panel:
- Go to your Spaces dashboard.
- Select the
minimoj-consumerbucket. - Navigate to Settings > Permissions and ensure your access key has at least
ReadandWritepermissions for the bucket.
Step 4: Enable Multi-User Access (Optional)
If you need other users to access the mount point, enable allow_other:
- Edit
/etc/fuse.confand uncomment the line:user_allow_other - Remount with the
-o allow_otheroption added to the command above.
Managing Your Bucket Contents
Once mounted correctly, you can manage the bucket just like a local directory:
- Create directories:
mkdir /home/ivan/hosts/docker-symfony/symfony/do1/new-folder - Upload files:
cp local-file.txt /home/ivan/hosts/docker-symfony/symfony/do1/ - Delete files:
rm /home/ivan/hosts/docker-symfony/symfony/do1/old-file.txt
Note: If the bucket was empty (as suggested by the log warning), you'll need to create directories/files first before navigating into them.
内容的提问来源于stack exchange,提问作者shuba.ivan

