Mounting NULLFS On Boot

Status
Not open for further replies.

NOX

Dabbler
Joined
Nov 25, 2014
Messages
10
Hello FreeNAS Community,

I am currently in the process of setting up a SFTP server off my FreeNAS box. I am at the step where I need to allow the "guest" account to see outside of their chroot. I found that ProFTPd doesn't like symbolic links, and for a good reason. After doing a little research I found that I could get around this issue by mounting a directory read-only within the user's chroot.

When mounting the directory with the command directly below everything works as it should.
Code:
mount -t nullfs /mnt/storage/software/dev /mnt/storage/homes/sftp/Dev


Since this command only lasts till the next time my FreeNAS box reboots I need to have this automatically mount on startup, and I know that this can traditionally be done by editing the '/etc/fstab'. Since FreeNAS is a little different than a traditional BSD OS I understand you have to take the following steps to edit the 'fstab' file.
Code:
mount -uw /
vi /conf/base/etc/fstab

# Append Line to '/conf/base/etc/fstab'
/mnt/storage/software/dev /mnt/storage/homes/sftp/Dev nullfs ro 0 0

reboot


Upon rebooting my FreeNAS box I receive an error during startup stating that "Mounting local file systems:mount: /mnt/storage: No such file or directory.", which I assume is because my volume has not yet been mounted. Can anyone assist me in telling me where / how to mount this directory on startup?

Thank you very much for your time, and any assistance at all would be very appreciated!

P.S. Using FreeNAS 9.2.1.9 x64

::EDIT::
I would still like to understand how to use the 'fstab' file option, but I got the same results using a startup script that you can see below.
Code:
mount -uw /
vi /conf/base/etc/rc.d/rc.local

# Append Line to '/conf/base/etc/rc.d/rc.local'
mount -t nullfs /mnt/storage/software/dev /mnt/storage/homes/sftp/Dev
...
...

reboot
 
Last edited:

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
For SFTP I create a jail then add storage to it through the GUI. This has the added advantage of cleanly segregating your sftp users from your host system. Makes it that much harder to break out of sftp server. It also avoids mucking around with CLI on host system.
 
Status
Not open for further replies.
Top