Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I wish to set up a network drive for storing my personal photos. I already have a server and a 'pictures' user on the server. I planned to store the photos in the home directory of this user.

I already tried to set up an sshfs mount in fstab but that didn't quite work. I believe the reason was that my laptop is currently only on wifi and fstab would have required wired connection even when using _netdev option.

Then I saw this http://ubuntuforums.org/showthread.php?t=896474&p=5635104#post5635104 which adds mounting scripts to network if-up and if-down. But for some reason even that didn't work. When wifi connection was created the if-up script was not run.

Then I tried to use the "Connect to server" in Nautilus. This looked very promising and it sort of works. Only down side is that places connected with that option do not show up in browsers upload file dialog. And it would be one of the main use cases that I attach a picture to an email.

So my question is how could I mount a network drive so that: 1) the drive would be usable from applications like browser 2) it is automatically connected when network is available or when the bookmark or directory in Nautilus is clicked 3) Can be used by multiple users 4) easy to use even by nontechnical persons (setup can be more demanding)

Is there such a way?

share|improve this question
    
What about Bit Torrent Sync like this: askubuntu.com/questions/284683/how-to-run-bittorrent-sync –  jmunsch Jan 14 at 22:06
    
Wouldn't Bit Torrent Sync actually download the content of the synced drive on your machine? My laptop has a smaller ssd drive so I can't store the pictures locally at all. –  Mika Jan 15 at 5:34

1 Answer 1

up vote 1 down vote accepted

Then I tried to use the "Connect to server" in Nautilus. This looked very promising and it sort of works. Only down side is that places connected with that option do not show up in browsers upload file dialog

Nautilus mounts those files under ~/.gvfs/share_name and they are available in the browsers upload file dialog from that directory too. Maybe the dialog hides that folder, because it is hidden, just press CTRL+H in the dialog to toggle showing hidden files/directories and browse to that folder.

To mount the same way as Nautilus mounts just use the command

gvfs-mount "ssh://user@host:port"

(Obviously filling out the parts correctly.) You can make a simple bash script with that command:

#!/bin/bash
sleep 20
gvfs-mount "ssh://user@host:port"

make it executable and make that script autostart with your login. (e.g. by typing "startup" in Dash and using the "startup applications" app to set it up.) This script will wait 20 seconds after startup to mount the share, if you need more or less time for the wifi to come up just change the number in the script to the seconds you want.

share|improve this answer
    
Well, yes in theory. I added a bookmark to that .gvfs/ directory into Nautilus, but when I clicked that bookmark in the upload file dialog it opened my servers root path and I needed to navigate to /home/pictures/ to find my pictures. I could do it but my wife shouldn't need to know the internal structure of my server. I forgot one requirement, 4) it should be usable by nontechnical persons. –  Mika Jan 15 at 5:27
    
@Mika The bookmark thing in Nautilus could be used to initiate the connection and make the mount, but it will mount the whole share. To access the files easily just make a symlink to the remote directory you want, e.g. with ln -s ~/.gvfs/share_name/home/pictures name_for_the_link and use this symlink to access that particular folder. You can make that symlink in any directory you want. Of course the link will be broken when the server is not connected, but then you just click that bookmark in Nautilus and everything is in order. –  falconer Jan 15 at 7:01
    
This sounds good. But could that connecting part be automated in anyway? Would be awesome if Nautilus could run a script when it is started. I found some story about Nautilus scripts g-scripts.sourceforge.net, but saw nothing about running them when Nautilus starts. If it could run a script when it start, then I think it could also run a simple sshfs command to mount the drive. –  Mika Jan 15 at 11:45
    
@Mika Of course it can be. But seeing your luck with the automounting I didn't propose it. :) If you autostart it only with your login it should be fine. –  falconer Jan 15 at 12:14
    
Thanks, I'll try that out when I get to home. Though I think the script needs some modification to work on wifi. I believe the startup applications are run before the wifi connection is established. –  Mika Jan 15 at 13:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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