Mounting fuse sshfs fails when invoked by Cron on FreeBSD 9.0

Posted by Tal on Server Fault See other posts from Server Fault or by Tal
Published on 2012-09-21T14:41:47Z Indexed on 2012/09/21 15:40 UTC
Read the original article Hit count: 227

Filed under:
|
|
|

I have a remote server filesystem that I'm attempting to mount locally on a FreeBSD 9 machine via FUSE sshfs, and Cron for a backup routine. I have ssh keys between the boxes setup to allow for passwordless login as the root user on the local machine.

Cron is set to run the following script (in Root's crontab):

#!/bin/sh

echo "Mounting Share"

/usr/local/bin/sshfs -C -o reconnect -o idmap=user -o workaround=all <remote user>@<remote domain>.com: /mnt/remote_server

As root, I can run this script on the command line without issue, and without being asked for a password the share mounts successfully. Yet, when run by Cron the script fails. The path to sshfs is identical to the value of which sshfs

Here is the email root receives from the Cron Daemon:

X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>

Mounting Share
fuse: failed to exec mount program: No such file or directory
fuse: failed to mount file system: No such file or directory

I'm stumped as to why I'm receiving No such file or directory in this instance. It further seems odd given that the paths appear to be correct.

I've also attempted to compare the output of env on the shell with env inserted into the script. I don't see any environment variables that should cause this trouble. At bootup, FUSE reports its version as:

fuse4bsd: version 0.3.9-pre1, FUSE ABI 7.8

Help me ServerFault wizards, you're my only hope!

© Server Fault or respective owner

Related posts about cron

Related posts about freebsd