Auto Mount a SMB Share at Boot On Mac OS X

KB Home   |   Auto Mount a SMB Share at Boot On Mac OS X

As part of PaperCut’s Print Archiving feature on a Mac OS X secondary server you may need to automatically mount a SMB share so that the PaperCut Print Provider can provide the appropriate files for archiving by the PaperCut Application Server.

We have had an elegant solution presented to us by one of our customers - Sam from MacKillop College in Australia.

The resolution I came up with has two parts, a shell script and a launchd.
A shell script papercutmount.sh:
#!/bin/bash
# Source variables from print-provider.conf
. /Applications/PaperCut\ MF/providers/print/mac/print-provider.conf
# Log in as local PaperCut account and execute all following commands as this user
su papercut << EOS
# Create a folder to mount to
mkdir $ArchiveDir
# Mount the share
mount -t smbfs //$ArchiveUser:$ArchivePass@$ApplicationServer/archive $ArchiveDir
EOS
And the launchd saved in /Library/LaunchDaemons/com.papercut.maparchive.plist (note to change the path to the shell file)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.papercut.maparchive.plist</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/papercutmount.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Then the following variables also need to be added to the print-provider.conf file, as users only need to enter this info in the one place where they are familiar to setting config options.
ArchiveDir=/Volumes/archive
ArchiveUser=svc-papercut
ArchivePass=PASSWORD
Downside is that the password is in clear text, however this is a limited domain account on a “secure” server. If this was an issue, you could use one of these methods: http://serverfault.com/questions/367950/secure-way-to-mount-a-password-protected-cifs-share-in-mac However, it may require some more user interaction.
One final note is that if the PaperCut Application Server is rebooted, the mounted shares are disconnected and the Mac OS X Secondary Print Server will fail to save the print archive files. The quickest fix is to re-run the script or reboot the Secondary server.

Categories: Apple Mac OS X, Implementation / Deployment, Support, Tips & Tricks


Keywords: TODO keywords here if needed

Comments

Share your findings and experience with other PaperCut users. Feel free to add comments and suggestions about this Knowledge Base article. Please don't use this for support requests.

Article last modified on April 04, 2013, at 04:31 AM
Printable View   |   Article History   |   Edit Article