Difference between revisions of "CentOS 7.x mount samba share"

From Notes_Wiki
m
m
Line 43: Line 43:
* https://www.looklinux.com/how-to-mount-samba-share-smbfs-in-linux/
* https://www.looklinux.com/how-to-mount-samba-share-smbfs-in-linux/


=Adding samba mount to /etc/fstab=
We can add Samba mount to /etc/fstab via:
<pre>
//<server>/<share> <local-mount-point> cifs username=administrator,password=<redacted>,file_mode=0777,dir_mode=0777,noauto 0 0
</pre>
Here:
; file_mode=0777 and dir_mode=0777 : are used to allow the files to be edited by everyone. 
; noauto : Ensures that this is not automatically mounted on boot




<yambe:breadcrumb self="Mount samba share">CentOS_7.x_Samba|Samba</yambe:breadcrumb>
<yambe:breadcrumb self="Mount samba share">CentOS_7.x_Samba|Samba</yambe:breadcrumb>

Revision as of 11:38, 3 August 2022

<yambe:breadcrumb self="Mount samba share">CentOS_7.x_Samba|Samba</yambe:breadcrumb>

CentOS 7.x mount samba share

To mount samba (CIFS or Windows file sharing) file share in Linux use

  1. yum -y install cifs-utils samba-client
  2. Create desired mountpoint such as:
    mkdir /mnt/fileserver
  3. List mountpoints using:
    smbclient -L <IP> -U username
    and enter password for listing mount points
  4. To access files without mouting use:
    smbclient //<ip>/share -U username
    and enter password to get smb client based file access.
  5. Mounting using command similar to:
    mount -t cifs --verbose '//<IP>/<share-name>' /mnt/fileserver -o 'username=administrator,password=secret'
  6. In case of older Windows Server 2003 above command fails with output:
    mount.cifs kernel mount options: ip=<ip>,unc=\\<server>\<share-name>,user=administrator,pass=********
    mount error(95): Operation not supported
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
    with /var/log/messages having suggestion:
    Apr 8 22:05:04 localhost kernel: No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.
    Apr 8 22:05:04 localhost kernel: CIFS VFS: Dialect not supported by server. Consider specifying vers=1.0 or vers=2.0 on mount for accessing older servers
    Apr 8 22:05:04 localhost kernel: CIFS VFS: cifs_mount failed w/return code = -95
  7. After this mounting worked using:
    mount -t cifs --verbose '//<IP>/<share-name>' /mnt/fileserver -o 'username=administrator,password=secret,vers=1.0'


Refer:


Adding samba mount to /etc/fstab

We can add Samba mount to /etc/fstab via:

//<server>/<share> <local-mount-point> cifs username=administrator,password=<redacted>,file_mode=0777,dir_mode=0777,noauto 0 0

Here:

file_mode=0777 and dir_mode=0777
are used to allow the files to be edited by everyone.
noauto
Ensures that this is not automatically mounted on boot


<yambe:breadcrumb self="Mount samba share">CentOS_7.x_Samba|Samba</yambe:breadcrumb>