Ben Stienstra

Linux, Unix, network, radio and more...

User Tools

Site Tools


autofs_smb_fedora_26

~~TOC~~

Fedora 26 - autofs SMB v3

  • Install required packages:
    sudo dnf -y install autofs samba-client samba-common
  • Set some variables:
    nashostname=<nashostname>
    nasshare=<nassharename>
    localmount="${HOME}/${nashostname}"
    
  • Create mount point:
    mkdir ${localmount}
  • Configure autofs:
    # Add master map
    sudo tee /etc/auto.master.d/${nashostname}.autofs <<EOF
    ${localmount}    /etc/auto.${nashostname}    --timeout=600 --ghost
    EOF
    
    # Add autofs map (append)
    sudo tee -a /etc/auto.${nashostname} <<EOF
    ${nasshare}    -fstype=cifs,rw,noperm,vers=3.0,credentials=/etc/.smbcred.txt   ://${nashostname}/${nasshare}
    EOF
  • Configure credentials for auto mounting. Be careful when storing credentials in plain text.
    sudo vi /etc/.smbcred.txt 
    
    username=value
    password=value
    domain=value
    sudo chown root:root /etc/.smbcred.txt
    sudo chmod 600 /etc/.smbcred.txt
  • Enable and start autofs:
    sudo systemctl enable autofs --now
autofs_smb_fedora_26.txt · Last modified: 2017/09/09 10:12 by admin