I have a server I connect to using ssh in pantheon-files, how do I make the network file system remain mounted after reboot?

  • try a custom bash script that mounts the server then make it execute every time system starts Jul 19, 2015 at 16:39
  • I guess that would be the best way and maybe only way. Jul 19, 2015 at 17:25

1 Answer 1


The easy way to mount a filesystem during boot is to list it in /etc/fstab. However, SSHFS is a FUSE filesystem, so mounting it from a system configuration file is tricky: you wouldn't have permission to access it under your account.

While it's possible to get this done, it's easier to do the mounting from your account.

You can use cron to schedule a task at boot time to mount that filesystem. Run the command crontab -e to edit the list of scheduled tasks for your account, and add a line:

@reboot sshfs remotehost.example.com:/remote/path /path/to/mount/point

Note that the sshfs mount command won't have access to any interactive environment, so it won't be able to ask you for a password or for a key passphrase. If you need that, you'll need to arrange to run the command when you log in, not when the system starts.

If the network connection isn't available at boot time, you may want to do the mounting when the network becomes available. To do that, add a file to the if-up.d directory called john-mount-sshfs and containing the following code (replace john by your username, and replace the host name and paths):

su -c john <<'EOF'
if ping -c 1 remotehost.example.com >/dev/null 2>/dev/null; then
  sshfs remotehost.example.com:/remote/path /path/to/mount/point

If you need to supply credentials to the sshfs command, then autosshfs is likely to be more convenient. It mounts the directory on first access, so you can supply the credentials at that time.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.