Skip to content

Instantly share code, notes, and snippets.

@alloydwhitlock
Created December 1, 2025 00:53
Show Gist options
  • Select an option

  • Save alloydwhitlock/1ea2d08fba7a3590e19bd2e3060dffa8 to your computer and use it in GitHub Desktop.

Select an option

Save alloydwhitlock/1ea2d08fba7a3590e19bd2e3060dffa8 to your computer and use it in GitHub Desktop.
Mounting Script for NFS
#!/bin/bash
# /usr/local/bin/mount-nas.sh
NAS_IP="192.168.69.420"
USERNAME="username"
PASSWORD="password"
SHARES=("Movies" "Music" "Shows" "Photos")
echo "Starting Finder-based SMB mounting..."
for share in "${SHARES[@]}"; do
echo "Mounting $share..."
# Use osascript to mount via Finder
osascript -e "
tell application \"Finder\"
try
mount volume \"smb://$USERNAME:$PASSWORD@$NAS_IP/$share\"
return \"success\"
on error
return \"failed\"
end try
end tell
"
# Check if mounted
if [ -d "/Volumes/$share" ] && [ "$(ls -A /Volumes/$share 2>/dev/null)" ]; then
echo "✓ Successfully mounted $share"
else
echo "✗ Failed to mount $share"
fi
done
echo "Mount script completed."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment