SMB (Server Message Block, spoken "Samba") is a suite of programs supplied with all Linux distributions (and Mac OS X) that enables UNIX systems to both access shared resources on Windows PCs, and act as servers for them.
Mounting samba shares
How do you access a Windows share from Linux?
smbmount //winbox/share /mnt/share -o username=joe,password=bloggs
To unmount it:
To mount it persistently, you must add uid and gid entries to the smbmount command in the /etc/fstab entry:
//winbox/share /mnt/share smbfs username=joe,password=bloggs,uid=500,gid=500 0 0
where the uid and gid are of the user or group you want to have rw access.
If your Windows server requires signing/sealing (i.e. Windows 2003), you need to use mount.cifs (available in samba-3.0.x and in some distributions with samba-2.2.x), which requires the cifs filesystem module (in 2.6 kernels and some distributions have it in their 2.4 kernels - such as Mandrake 9.2 and later).
It is a good idea to use the above syntax for the first time you connect to a new system, to ensure that everything works correctly. Remember to clear the history if others have access to the root account! If you will be regularly using the same Windows account, then it is useful to store the details in a file rather than entering it in plain text each time. To do this create a text file in your home directory, e.g. winbox-credentials.txt, and put two lines in it:
Save it, and change the file permissions to restrict access to your own account
chmod 600 winbox-credentials.txt
You can now use the syntax:
smbmount -o credentials=/home/joe/winbox-credentials.txt //winbox/share /mnt/share
To mount a share from Windows 2008 with Linux use one of the following commands, depending on what commands you have available on your Linux:
# smbmount //winbox/share /mnt/smb -o rw,username=Administrator,password=yourpassword
# mount.cifs //winbox/share /mnt/smb -o user=Administrator
smbmount //WINSERVER/SHARENAME /mnt/win98share -o servern=WINSERVER,ip=192.168.50.1,\ workgroup=WORKGROUP,password=PASSWORD
The NetBIOS server name (WINSERVER in the above example) should be written in upper case. This also applies to the name of the workgroup (WORKGROUP), the name of the shared directory (SHARENAME) and the password (PASSWORD). That is, if you set the password "barR123" on the share of your Windows 98 server, you have to pass "BARR123" to the smbmount-command.
The ip parameter (192.168.50.1 in the above example) must be passed the IP address of the Windows 98 server.
How can I mount a share automatically at boot?
You need to place an entry in your /etc/fstab file. As above, make sure you have created the mount point before you boot. The fstab entry should look like:
//winbox/share /mnt/share smbfs rw,credentials=/home/joe/winbox-credentials.txt 0 0
How can I mount a share as read only?
The above examples mount as readable and writable "rw", for read only change it to "ro".
Configuring your samba server
Main Article: Setting up a Samba Server
Also, some filemanagers have built-in browsers, for example typing smb:/ in Nautilus or Konqueror will access the network browser. XFCE's filemanager is also a good one. Konqueror also allows you to browse all machines in your LAN via lan:// in the address bar (if Lisa is configured and running).
- Red Hat 9: redhat-config-samba
- yast2 samba-server
unknown file system type smbfs
unknown file system type smbfs
As response to the command
mount -t smbfs
Use mount.cifs instead of mount -t smbfs