Easy way to mount CIFS in (Fedora) linux via autofs

after struggling with HOWTO Forge’s recipe and Fedora’s modification of the same recipe, CentOS provides some helpful info on how to set things up the easy way:

# yum install autofs cifs-utils
# mkdir /mnt/smb

Add this line to /etc/auto.master:

 

/mnt/smb /etc/auto.smb.top

Create /etc/auto.smb.top as:

 

* -fstype=autofs,-Dhost=& file:/etc/auto.smb.sub

Create /etc/auto.smb.sub as (adjust as needed):

 

* -fstype=cifs,credentials=/root/secret.txt,uid=500,gid=100 ://${host}/&

Now you can access by simply typing:

 

# cd /mnt/smb/winbox/getme

Add a Comment

Your email address will not be published. Required fields are marked *