User Tools

Site Tools


Advertisements: AliExpress Hide Your IP Microsoft Products
linux:debian:access_windows_samba_share

How to Access Windows Shares from Debian

Let me just note that I am not a Linux expert. Since I mostly use Xfce desktop on Debian, I sometimes have problems which are not valid for other Linux users. For example, Debian (jessie) with Xfce desktop does not come with samba packages preinstalled which allows to access windows shares or share folders for windows users. Finally I figured out how to do it and I write the instructions here for others like me. I have uninstalled every packages related to my samba experiment and I installed following packages.

$ aptitude install samba samba-client samba-vfs-modules winbind cifs-utils gigolo gvfs gvfs-bin gvfs-backends 

The package gigolo is to manage/connect/mount remote filesystems and is a part of Xfce goodies project. gigolo will allow us to connect to windows shares. After installing required packages run gigolo from shell or from menu and create a new connection like below with approriate inputs.

Then you can connect to windows share from thunar. It is nice and easy.

If you would like to have a desktop shortcut, you need to create a launcher. Right click on the desktop and press Create Launcher… menu and create a launcher like this;

When you save this launcher, you can access your share from desktop by double click.

However, if you want to edit files from share by clicking and editing them, you cannot do this with this method ( I don't know why). I mounted this share to my desktop to overcome this. From shell as root, create a folder on desktop and mount the samba share on this folder with correct username and password.

$ mount -t cifs //192.168.1.3/share /root/Desktop/SERVER -o username=<username>,workgroup=<WORKGROUP>
# unmounting is simply;
# umount /root/Desktop/SERVER

What if you want to make this mount permanent, then you can add this entry below to /etc/fstab. Do not forget to change username, password, mount folder and target share, etc.

//192.168.1.3/share /root/Desktop/SERVER cifs username=<username>,workgroup=<WORKGROUP>,password=<password>,file_mode=0777,dir_mode=0777,noperm

The options file_mode=0777,dir_mode=0777,noperm is to give write access to other users if you mount it to a place where non-root users can access. You can omit them if you like. Check options with man mount.cifs.

It is important to know the SMB version of the remote share because version 1.0 is disabled now by many IT professionals due to wannacry like ransomware, so you may need to explicitly define the SMB version. man page of mount.cifs describes the available versions

vers=
           SMB protocol version. Allowed values are:

           ·   1.0 - The classic CIFS/SMBv1 protocol. This is the default.

           ·   2.0 - The SMBv2.002 protocol. This was initially introduced in
               Windows Vista Service Pack 1, and Windows Server 2008. Note
               that the initial release version of Windows Vista spoke a
               slightly different dialect (2.000) that is not supported.

           ·   2.1 - The SMBv2.1 protocol that was introduced in Microsoft
               Windows 7 and Windows Server 2008R2.

           ·   3.0 - The SMBv3.0 protocol that was introduced in Microsoft
               Windows 8 and Windows Server 2012.

           Note too that while this option governs the protocol version used,
           not all features of each version are available.

Let me know if anything is missing or incorrect.

Troubleshooting

If you have authentication problems with your Windows Active Directory Server you may use smbclient executable from terminal with correct parameters and identify the problem.

# This code lists the available shares and services of the remote host
$ smbclient -U <user_name> -W <domain_name> -L <remote_host>

For example, I got NT_STATUS_INVALID_WORKSTATION error and then I changed the logon workstations to “All computers” for the active directory user as depicted below. This solved my logon problem.

Discussion

Enter your comment. Wiki syntax is allowed:
 
linux/debian/access_windows_samba_share.txt · Last modified: 2017/06/07 13:28 by ozan