[Tutorial] Use CLI to connect to your ZimaOS SAMBA shares on Windows/macOS

SAMBA is the default sharing protocol on ZimaOS. With SMABA, you can access your photos, videos from another phone or computer, so that you can put data in one place and access or share them everywhere.

The specific benefits of SAMBA sharing are listed in this table:

SAMBA USB drives
Data Duplication? No Yes
What devices? Phones, TVs, Computers USB ports equipped
When and where? Any time devices have a network Where USB Plugged
How many devices? Many at the same time One at a time

Today, we will use CLI to connect ZimaOS’ folders on macOS and Windows.

For Mac Users

Open a text editor and copy these codes. We suggest VSCode as the text editor.

#!/bin/bash

# Prompt the user for IP address, username, and password
read -p "Enter IP Address: " IP
read -p "Enter Username: " USERNAME
read -p "Enter Password: " PASSWORD
echo ""

# Build the SMB URL
SMB_URL="smb://$USERNAME:$PASSWORD@$IP"

# Display connection information
echo "Connecting to: $SMB_URL"

# Open the shared path in Finder
open "$SMB_URL"

# Completion message
echo "SMB connection command executed. Check Finder for the result."

Save this to a file named like Connect to ZimaOS.sh.

Open terminal and type bash (do not miss the space). Then, drag the .sh file into the terminal app and press Enter to run the script.

This script will prompt you to input your ZimaOS’ IP address, username and password. Double check your inputs to ensure correctness. After confirmation, press Enter and you will be in your sharing panel.

For macOS users, you can drag the destination folder to the left panel to get quicker access in the future.

For Windows Users

Open Notepad.exe and copy-paste these codes:

@echo off
echo Please enter the following details:
set /p IP=Enter IP Address: 
set /p USERNAME=Enter Username: 
set /p PASSWORD=Enter Password: 

:: Delete previous network drive if exists
net use \\%IP%\ /delete /y

:: Save credentials using cmdkey
cmdkey /add:%IP% /user:%USERNAME% /pass:%PASSWORD%

:: Map the network drive
net use \\%IP%\ /USER:%USERNAME% %PASSWORD% /PERSISTENT:YES

:: Open the network share
start explorer \\%IP%\

:: Pause for a moment to allow explorer to open the folder
timeout /t 2 /nobreak > NUL

:: Refresh the folder window using PowerShell
powershell -Command "
Add-Type -TypeDefinition @'
using System.Runtime.InteropServices;
public class WinAPI {
    [DllImport(\"user32.dll\")]
    public static extern bool SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
}
'@
\$HWND = (Get-Process | Where-Object { \$_.MainWindowTitle -match '%IP%' }).MainWindowHandle
if (\$HWND -ne [IntPtr]::Zero) {
    [WinAPI]::SendMessage(\$HWND, 0x0111, [IntPtr]0x702C, [IntPtr]0)
} else {
    Write-Host \"Window not found.\"
}
"

echo Commands executed successfully.
pause

Save that text file and give it a ‘.bat’ suffix. Now, click to run this script.

This script will prompt you to input your ZimaOS’ IP address, username and password. Double check your inputs to ensure correctness. After confirmation, press Enter and you will be in your sharing panel.

Windows users can right click the destination folder and choose the map network drive so that you can view your folders in This PC panel.

1 Like

This does not work on my Windows 11 PC. After running the .bat I get a bunch of error msgs. It shows an explorer window with my shares and I can access them. I cannot click on the “Network” main directory. Then I loose the connection and I can go back to the last active window.

Messages look like this:


CMDKEY: Credential added successfully.
The command completed successfully.

'Add-Type' is not recognized as an internal or external command,
operable program or batch file.
'using' is not recognized as an internal or external command,
operable program or batch file.
'public' is not recognized as an internal or external command,
operable program or batch file.
'[DllImport' is not recognized as an internal or external command,
operable program or batch file.
'public' is not recognized as an internal or external command,
operable program or batch file.
'}' is not recognized as an internal or external command,
operable program or batch file.
''@' is not recognized as an internal or external command,
operable program or batch file.
'\$HWND' is not recognized as an internal or external command,
operable program or batch file.

What is going on?

Just provide us with a screen record. Thanks.

Sorry for the long delay, other urgent things to do!

Nothing more to show. Before these messages appear the explorer shows all shares.

Try to run this both in the cmd and PowerShell to elimilate the possible limitation from the environment.

Use Notepad.exe to paste and save the code.

Hope you can record the process of your operations to locate possible issues.

Sorry to necro an old thread, but I’m having the exact same issue as Hoekbrwr, and still getting the exact same errors that they did.

Using both Powershell and Command (both in Administrator mode) resulted in the errors they listed in the April 2025 screenshot.
The script file ran, and a Network Explorer window did open with access to my shares; but as soon as that particular window is closed, all access goes away & I’m back to square one.
Trying to access the shares via the Networking section of Explorer results in the “Windows cannot access \\ZimaOS” message. (windows error code 0x80070035)

I just re-installed Window 11 from scratch barely 2 hours ago, just to make sure I had no previously saved credentials or settings tweaks to bung things up. I’ve quite literally done zero networking with this machine after Windows install.

I’ve seen the comments in other threads about using the Zima client app, but I honestly shouldn’t have to use a dedicated app for simple file access, and I don’t like that doing so requires a VPN connection (which installs a whole other app on my PC) to use it. (i already have VPNs setup on my PC and my phone, and the Zima client throws all those to hell in order to work)

So is there anything else we can do to get simple file sharing working? Or do I need to find another server software?

Hi @Sassquatch0

I just tried this using the instructions and script to do this and it worked fine.

But I didn’t need to run any Command or Powershell instructions.

  1. Copy the script for Windows to notepad and save.
  2. Change the extension of this file from .txt to .bat
  3. Click on renamed file to run.
  4. Enter IP address
  5. Enter Username
  6. Enter Password

Then Window will open showing your folders. Right-click folder you want and choose “Map Network Drive”

Hope this helps :slight_smile:

Ok, my bad.
I missed the part where I had to mount/map the network locations, before closing the Network window after running the script.

So far it’s working.
Thanks for the tip.

1 Like

You’re welcome. Glad you got it figured out.

You might want to keep the .bat file you made handy in case you happen to lose a folder again, which can happen occasionally.

Update:
I don’t seem to have write privileges for the USB drive on my Zima machine. Anytime I try to write to that drive from Windows it gives this error :right_arrow_curving_down:, regardless of the source file or the source’s location.

BUT, I can write to the internal SATA HDD & M.2 SSD of the Zima machine from Windows.
Why is a USB share restricted? In Zima settings, they’re both shared the exact same way.

Hi @Sassquatch0

I know that some users have issues with drives connected via USB and, if I understand correctly, that will be addressed in the next release. For instance, I’m unable to create a new storage pool with my external USB drive enclosure. I’ve found that drives formatted in EXT4 seem to fair better in this environment, but that doesn’t help if your drive already has data on it, and I’m also unsure if this is your issue or not.

In the meantime, perhaps this post would be helpful?
I am away from home so unable to do any testing of this. Hopefully others have a solution for you if you’re still having trouble.