Although it is not answering your question exactly but I just wanted to mention that you can achieve the same goal using "sftp" as well. Just inside your file manager address bar type this command:
I would like to warn that, it seems that by default only the user which set up the mount can access the remote directory.
I set up a remote directory, and create a crontab with sudo crontab -e. Later I found out the backup file didn't write the remote directory at all. Then I found out that I could not cd into the remote disk as root ! So eventually I create the same task with crontab -e and everything works as I expected.
First install the module:
Load it to kernel:
Setting permissions (Ubuntu versions < 16.04):
Now we'll create a directory to mount the remote folder in.
I chose to create it in my home directory and call it
remoteDir
.Now I ran the command to mount it (mount on home):
Now it should be mounted:
Configure ssh key-based authentication
Generate key pair on the local host.
Accept all sugestions with enter key.
Copy public key to the remote host:
Install sshfs
Mount remote directory
Don't try to add remote fs to /etc/fstab
Or don't try to mount shares via /etc/rc.local .
In both cases it won't work as the network is not available when init reads /etc/fstab.
Install AutoFS
Edit /etc/auto.master
Comment out the following lines
Add a new line
Save and quit
Edit /etc/auto.sshfs
Add a new line
Remote user name is obligatory.
Save and quit
Start autofs in debug mode
Observe logs of the remote ssh server
Check content of the local directory
You should see contents of the remote directory
Start autofs in normal mode
Stop AutoFS running in debug mode with CTRL-C .
Start AutoFS in normal mode
Enjoy
(Tested on Ubuntu 14.04)
Based on my experiments, explicitly creating the fuse group and adding your user to it is NOT required to mount ssh file system.
To summarize, here are the steps copied from this page:
sshfs
$ sudo apt-get install sshfs
2.Create local mount point
$ mkdir /home/johndoe/sshfs-path/
3.Mount remote folder
/remote/path
to/home/johndoe/sshfs-path/
$ sshfs [email protected]:/remote/path /home/johndoe/sshfs-path/
$ fusermount -u /home/johndoe/sshfs-path/
Install sshfs
sudo apt-get install sshfs
Add to fstab:
Although it is not answering your question exactly but I just wanted to mention that you can achieve the same goal using "sftp" as well. Just inside your file manager address bar type this command:
An easy way to run sshfs mounts at startup is also by adding it to the
root
(or another user's) crontab, like this:And if you need to add a delay, you can use:
I would like to warn that, it seems that by default only the user which set up the mount can access the remote directory.
I set up a remote directory, and create a crontab with
sudo crontab -e
. Later I found out the backup file didn't write the remote directory at all. Then I found out that I could notcd
into the remote disk asroot
! So eventually I create the same task withcrontab -e
and everything works as I expected.