Mounting a Windows Share in Linux
Linux systems allow access to Windows and Samba file shares. cifs (formerly smbfs) is used for this purpose.
You can connect to a Windows share from the command line of a Linux system as shown below.
First you have to install the cifs-utils package. Use the following command under Ubuntu:
sudo apt-get install cifs-utils
The following example values will be used in this example:
- IP address for the server: 192.168.1.100
- Share name: freigabe
- User name: testuser
- Domain: testdomain
To mount the network share, use the following command and enter the password of the user:
admin@adminpc-ubuntu:~$ sudo mount -t cifs //192.168.1.100/freigabe /mnt -o user=testuser Password:
Troubleshooting Disconnects
In the event of unintentional disconnects, it may be helpful to explicitly use a newer protocol version (e. g. vers=2.1). You will find information on this in a post on stackexchange.com.[1]
smbfs
smbfs should not be used,[2] however you will find several pieces of information about it here for historical reasons:
An attempt to use smbfs will fail with the following message:
admin@adminpc-ubuntu:~$ sudo mount -t smbfs //192.168.1.100/freigabe /mnt -o username=testuser mount: wrong fs type, bad option, bad superblock on //192.168.1.100/operating-systems, missing codepage or helper program, or other error (for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program) In some cases useful info is found in syslog - try dmesg | tail or so admin@adminpc-ubuntu:~$
The output from dmesg will appear in this case:
[18427.113492] smbfs is deprecated and will be removed from the 2.6.27 kernel. Please migrate to cifs [18427.113499] smb_fill_super: missing data argument [18539.255884] smbfs is deprecated and will be removed from the 2.6.27 kernel. Please migrate to cifs [18539.255891] smbfs: mount_data version 1919251317 is not supported
So that smbfs can be used, the smbfs package will be required under Ubuntu.
References
- ↑ CIFS randomly losing connection to Windows share (unix.stackexchange.com, 29.05.2017)
- ↑ SambaClientGuide (help.ubuntu.com)
Additional Information
- http://www.samba.org/cifs/
- Samba Client cifs (wiki.ubuntuusers.de)