List and Define SMB Shares from Command-Line

sharingsmbterminal

In MacOS, is it possible to list and/or define SMB shares at the command-line?

On a Linux machine with Samba, I can use the testparm command and the /etc/samba/smb.conf file.

On Windows it would be the net share ... command.

On Mac, I only know the "System Preferences" > "Sharing" GUI. But to check or set these shares on multiple machines, I would like to be able to do it through SSH sessions and the command-line.

Is this possible?

Best Answer

On macOS open Terminal and type man sharing to review the manual page. You can use sharing -l to list AFP/SMB share info. You can add and remove shares using this command line tool.

You can use the df -h command or mount command to list externally mounted volumes & shares.