Mount SMBFS
Mount SMBFS
This is useful for automation, scripting, or when working without a GUI.
Using mount_smbfs Command
Step 1 – Create a Mount Point Before mounting, create a local directory where the share will be accessible:
mkdir -p /mnt/smbshare
Step 2 – Mount the SMB Share Run the mount_smbfs command with the appropriate syntax:
mount_smbfs //username@server/sharename /mnt/smbshare
Replace username with your SMB account name
Replace server with the hostname or IP address
Replace sharename with the shared folder name
If authentication is required, you’ll be prompted for a password unless you use the -N option and store credentials in ~/.nsmbrc or ~/Library/Preferences/nsmb.conf
Example with Workgroup and IP Address:
mount_smbfs -W WORKGROUP //user@192.168.1.19/data /mnt/smbshare
Step 3 – Unmount the Share When done, unmount using:
umount /mnt/smbshare
Alternative macOS Method (Preferred)
On macOS, it’s recommended to use the system mount command instead of calling mount_smbfs directly
sudo mount -t cifs //centos-server-ip/samba /path/to/mount-point -o username=username