JWK - Jackall's IT Wiki

Sécurité, Système, Réseau

Outils pour utilisateurs

Outils du site


en:mount_cifs_share_fstab

Mounting CIFS share with fstab

How it works

Here is how I automatically mount CIFS share (from a remote Win2K3) without asking for a password. Architecture:

  • CIFS server name : SRVDATA
  • target share : Interne
  • local user : damien
  • mount directory: /media/srvdata/Interne

fstab

/etc/fstab
//SRVDATA/Interne /media/srvdata/Interne cifs _netdev,users,noauto,users,credentials=/home/damien/.smbcred 0 0

Note that the source is define with

//

, and that you have to be able to resolve serveur name.

  • _netdev: tells fstab that this line involve a remote share.
  • users: enable normal user to mount and unmount the share
  • credentials : point to the file where credentials to access the share are stored.

SMBCRED

/home/damien/.smbcred
username=login.without.domain
password=XXXXXXX
domain=DOMAIN.IN.UPPERCASE

Permissoins

ll /home/damien/.smbcred 
-rw-r-----. 1 damien root 60  3 avril 19:03 /home/damien/.smbcred
[root@LWKS-damien ~]# 

search?q=CIFS%20Fstab%20Mount%20Linux%20EN&btnI=lucky

en/mount_cifs_share_fstab.txt · Dernière modification: 2018/02/18 16:01 (modification externe)