On macOS, the smbutil command does not seem to have the capability that you are looking for. It is possible that you may need to use smbclient instead. However, as of this writing, smbclient is not available by default on macOS. If you are using Homebrew, you can install it using the following command:
brew install smbclient
Once installed, you can use smbclient to interact with SMB shares. Here is an example of how to connect to a share:
smbclient -L <server> -U <username>
Replace <server> with the name or IP address of the server hosting the SMB share, and <username> with a valid username. This command will list the available shares on the server.
To connect to a specific share, use the following command:
smbclient //<server>/<share> -U <username>
Replace <server> with the name or IP address of the server, <share> with the name of the share, and <username> with a valid username. This command will mount the share and open an interactive shell where you can navigate the share and transfer files.
Remember to replace <server>, <share>, and <username> with the appropriate values for your specific situation.
Here is a sample output of the smbclient -L command:
smbclient -L myserver -U myusername
Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
IPC$ IPC Remote IPC
myshare Disk My Share
Recommended Disk Recommended Documents
In this example, you can see that there are three shares available on the server: print$, IPC$, myshare, and Recommended. To connect to the myshare share, you would use the following command:
smbclient //myserver/myshare -U myusername
After connecting, you can navigate the share and transfer files using standard Unix commands like ls, cd, cp, and mv. To disconnect from the share, use the exit command.
Here is a simple example of transferring a file from the local machine to the share:
smbclient //myserver/myshare -U myusername
cd Documents
put mylocalfile.txt mysharedir/mysharedfile.txt
exit
In this example, the file mylocalfile.txt is transferred from the local machine to the mysharedir directory on the myshare share.
References: