Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


autofs_smb_fedora_26

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: 2021/10/09 15:14 by 127.0.0.1