CIFS, fstab, and You

Let's say you're a Linux admin in a Windows shop (ha) and you'd like to be able to access your company shares via a real operating system. Even more, you'd like these shares to be accessible immediately after boot.

//<server>/path /path/to/mount  cifs credentials=/home/<username>/.smbcreds,uid=1000,gid=1000,file_mode=0640,dir_mode=0750 0 0

Let's break this down. The first three fields and the last two are obvious. The fourth field is where the magic happens. credentials specifies the path to the (protected by 0600) file containing your AD credentials. uid, gid, file_mode, and dir_mode provide hints on how to handle a share that doesn't provide those values already. If the server provides these values then your hints are helpfully ignored.

Then in ~/.smbcreds:

username=<username>
password=<password>
domain=<domain>

Profit.