如何在Mac上通过SSH连接XAMPP-VM?附挂载目录权限设置求助
Hey there, let's tackle your two XAMPP-VM issues one by one—these are super common pain points for Mac users running the VM version:
XAMPP-VM uses a Bitnami-built stack, so the default SSH credentials aren't the typical root/password you might expect. Here's how to connect:
Step 1: Ensure SSH service is running
Open your XAMPP Manager, switch to the Manage Servers tab, and check if the "SSH" service is listed as "Running". If not, select it and click Start.Step 2: Connect via SSH using the default Bitnami credentials
Open your Mac's Terminal and run this command:ssh bitnami@192.168.65.2When prompted for a password, enter
bitnami(this is the default password for thebitnamiuser, which has full sudo access).Step 3: Switch to root if needed
Once logged in asbitnami, you can elevate to root with:sudo su -Enter the same
bitnamipassword when prompted—no separate root password is required by default.
If you still can't connect, double-check that your Mac's firewall isn't blocking SSH traffic to 192.168.65.2, and that the VM's default SSH port (22) is open.
The /opt/lampp directory in the VM is owned by system users (usually daemon:daemon or bitnami:daemon) by default, which is why your local mounted path doesn't have write access. Here are two reliable fixes:
Option 1: Adjust permissions directly in the VM (recommended)
Since the mount syncs with the VM's filesystem, modifying permissions inside the VM will reflect on your local mount:
- First, SSH into the VM using the method above.
- Run this command to give the
bitnamiuser full ownership of/opt/lampp(this won't break Apache/Nginx since the web server runs with permissions to access these files):sudo chown -R bitnami:bitnami /opt/lampp - Alternatively, if you want to keep the original ownership but add write access for the
bitnamiuser:
After running either command, you should be able to write to the localsudo chmod -R u+w /opt/lampp~/.bitnami/stackman/machines/xampp/volumes/rootpath immediately.
Option 2: Fix UID/GID mismatch (for advanced users)
Sometimes the local Mac user's UID/GID doesn't match the bitnami user in the VM, causing permission issues. Here's how to align them:
- In the VM, check the
bitnamiuser's UID and GID:
You'll get output likeid bitnamiuid=1000(bitnami) gid=1000(bitnami). - On your Mac, modify the mounted directory's permissions to match this UID/GID:
Replacesudo chown -R 1000:1000 ~/.bitnami/stackman/machines/xampp/volumes/root1000:1000with the actual UID/GID from the VM if they're different.
内容的提问来源于stack exchange,提问作者Nick

