home | codereading | contact | github | math | misc | notes | patches | tech | README

SMB (Samba) on Unix

Mounting smbfs from NetBSD

The following line is enough for mouting a SMB filesystem from NetBSD:

# mount_smbfs -W <workgroup> //<user>@<host>/<path> /mnt/smb/

Replace <workgroup>, <user>, <host> and <path> by the respective information for your user.

Them, type your password.

In my case, the $ at the end of the string looks necessary. Don't ask me why.

Mouting SMBFS from Linux

The Linux command line is equally easy:

# mount -t smbfs -o username=<user>,workgroup=<workgroup>,password=<password> //<host>/<path> /mnt/smb

Maybe you prefer including it in fstab:

//<host>/<path>  /mnt/smb cifs noauto,user=<user>,password=<password>

If you are using Ubuntu, don't forget to install the package called smbfs.

Discovering shared directories and other resources for a given host

If you don't know what SMB resources are available for a given host, you can use the smbclient command. The following example shows how to get a list of services (including shared directories and printers):

$ smbclient -W <workgroup> -U <user> -L <host>

Printing to a Windows Print server

You should first connect to the print server as you would do in any share:

$ smbclient -W <wordgroup> -U <user> "//ip/server name"

Then, just use the print command:

smb: \> print /tmp/a.pdf

This page helped me to find correct commands.