如何更改VMware共享文件夹挂载点?软链接权限问题求助
Hey István, I’ve run into this exact scenario before—let’s get this sorted out for you. The root of the problem is usually either how the shared folder is mounted (lacking user permissions) or misunderstanding how symlink permissions work. Here are three reliable solutions:
1. Mount the Shared Folder Directly to Your Target Location (Best Practice)
Instead of using a symlink, configure VMware to mount the shared folder straight to your desired path. This avoids permission headaches entirely:
- First, unmount the existing shared folder if it’s already mounted:
sudo umount /mnt/hgfs # Adjust this path to your current vmhgfs mount point - Create your target directory (replace
/path/to/your/targetwith your actual desired location):sudo mkdir -p /path/to/your/target - Edit the
/etc/fstabfile to add a permanent mount entry:
Add this line at the end (replacesudo nano /etc/fstabshared_folder_namewith your VMware shared folder name, and1000with your user’s UID/GID—find these with theidcommand):vmhgfs-fuse .host:/shared_folder_name /path/to/your/target fuse defaults,allow_other,uid=1000,gid=1000 0 0 - Save and exit nano (
Ctrl+O,Enter,Ctrl+X), then mount the folder immediately:sudo mount /path/to/your/target
2. Fix Symlink Permissions (If You Prefer Using a Link)
Symlinks themselves have minimal permission impact—what matters is the permissions of the target directory they point to. But if your symlink is owned by root and you want to adjust that:
- Use the
-hflag withchownto modify the symlink’s owner (not the linked folder):sudo chown -h your_username:your_group /path/to/your/symlink - If you still can’t access the shared folder through the symlink, double-check that your original vmhgfs mount includes the
allow_otherparameter. Edit/etc/fstaband addallow_otherto the mount options for the shared folder, then remount it.
3. Use a Bind Mount (Alternative to Symlinks)
A bind mount lets you mirror an existing mounted directory to another location, which acts like a symlink but behaves more like a direct mount:
- Create your target directory:
sudo mkdir -p /path/to/your/target - Set up the bind mount temporarily:
sudo mount --bind /mnt/hgfs/shared_folder_name /path/to/your/target - To make it permanent, add this line to
/etc/fstab:/mnt/hgfs/shared_folder_name /path/to/your/target none bind 0 0
Any of these methods should resolve your permission issues. The first option is the cleanest long-term solution since it eliminates the need for symlinks entirely.
内容的提问来源于stack exchange,提问作者István Radics

