List Network Volume
SMBUTIL
You can reveal the staus of the network drive (SMB volumes) via smbutil status $IP_or_Domain command:
| |
You can reveal the drive available via smbutil view -A //$usr@$ip (or with password smbutil view -A //$usr:$pwd@$ip), you will need to run the command once to authenticate, and another time to reveal the available volumes:
| |
SMBCLIENT
Preliminary Requirement
Samba is a free software re-implementation of the SMB networking protocol, and provides file and print services across multiple operating systems including Linux, Unix, and Windows. Smbclient is a command-line tool included in the Samba suite. It functions somewhat like an FTP client and allows users to connect to an SMB/CIFS (Common Internet File System) server.
Consequently we’ll install Samba first:
For MacOS device:
brew install sambaFor Linux device:
yum -y install samba samba-client samba-commonFor Windows device: https://www.liquidweb.com/kb/how-to-install-samba-on-linux-windows/
Usage
You can reveal the available volumes on the IP/Domain via command: smbclient -L //${ip} --grepable --user=${usr} --password=${pwd} --workgroup=WORKGROUP
| |
p.s. if you run into issue with the smbclient installed via brew on MacOS; You may try to resolve those via using the absolute path to the executable instead (use /opt/homebrew/bin/smbclient, instead of smbclient)
Mount/Unmount Network Drive (MacOS)
The following section only apply to mounting/unmounting SMB volumes in MacOS system (if you are using Windows system, you can use net use command, if you are using Linux system you can use cifs-utils)
To mount network drive:
| |
To unmount network drive:
| |
or
| |