Table of Contents

Mount networkshares

Clientpackages to mount shares

CIFS:

apt-get install cifs-utils

NFS:

apt-get install nfs-common

Temp. mount

CIFS / SAMBA

mount -t cifs //<SRV>/<SHARE>/ /mnt/<POINT>/
or with connection parameters
mount -t cifs //<SRV>/<SHARE>/ /mnt/<POINT>/ -o username=user,password=pass,domain=dom

Make sure you can access it and that you can see files. If you already have files at “//<SRV>/<SHARE>/” you can use

ls -al /mnt/<POINT>/
Also create a file with
touch /mnt/<POINT>/test
and check if it has been created.

NFS

mount -t nfs <server>:/<share>/ /<mountpoint>
or with additional parameters
mount -t nfs <server>:/<share>/ /<mountpoint> -o rw,bg,hard,intr,rsize=32768,wsize=32768,tcp,vers=3,suid,timeo=600

Make sure you can access it and that you can see files. If you already have files at “/<share>/” you can use

ls -al /<mountpoint>
Also create a file with
touch /<mountpoint>/test
and check if it has been created.

Perm. mount

CIFS / SAMBA

Insert in “/etc/fstab”

//<SRV>/<SHARE> /<MNTPOINT> cifs credentials=</root/.smbcreds>,iocharset=utf8,sec=ntlm 0 0

Insert in </root/.smbcreds>

username=<username>
password=<password>
domain=<domain>

Execute

mount -a

NFS

Insert in “/etc/fstab”

<server>:/share /<mountpoint> nfs rw,bg,hard,vers=4.0,suid,timeo=600,noatime,rsize=65536,wsize=65536,sec=sys 0

Execute

mount -a

Versions

CIFS

Version Description
vers=3.0 SMB3 i.e. Windows 8 and up, Windows Server 2012 and up
vers=2.1 SMB2_10 i.e. Windows 7, Windows Server 2008 R2
vers=2.0 SMB2_02 i.e. Vista SP1, Windows Server 2008
vers=1.0 NT1 i.e. Windows 95, NT 4.0

Commands

Command Function
showmount -e <nfsserver> show available nfs shares
mount -t nfs <server>:/<share> /<mountpoint> mount a nfs share
mount -t cifs //<server>/<share>/ /<mountpoint> mount a cifs share

Troubleshooting

Cant mount Windowsshares (CIFS) on Linux

Description

Mounting your share leads to the following error

mount error(9): Bad file descriptor

Reason

Microsoft released an Update (January 8, 2019 (Monthly Rollup)) which broke smb2.0 and 2.1 connections.

The issue affect Windows 7 and Windows Server 2008 (R2).

https://www.theregister.co.uk/2019/01/09/windows_7_network_broken/

https://serverfault.com/questions/948263/kb-4480970-and-or-kb-4480960-breaks-smb2-connections-to-windows-7-shares

Fix

Microsoft released a fix to fix their update… m(

This update resolves the issue where local users who are part of the local “Administrators“ group may not be able to remotely access shares on Windows 7 SP1 and Windows Server 2008 R2 machines after installing the January 8th, 2019 security updates. 
This does not affect domain accounts in the local "Administrators" group.

Download KB4487345 and install the fix: KB4487345

CIFS share is mounted but permission is denied

Description

Listing the files doesnt work because of missing permission

ll /<mount>
ls: reading directory /<mount>/: Permission denied
total 0

Reason

Wrong CIFS version

Fix

Add the correct version (vers=1.0/2.0/2.1/3.0) as an option

# in /etc/fstab as perm. mount
//<server>/<share> /<mountpoint> cifs credentials=</root/.smbcreds>,iocharset=utf8,sec=ntlm,vers=3.0 0 0

# temp. mount
mount -t cifs //<server>/<share> /<mountpoint> -o vers=3.0