Author Topic: Network File Storage  (Read 1588 times)

Cytochromec

  • Full Member
  • ***
  • Posts: 46
    • View Profile
Network File Storage
« on: April 03, 2012, 04:01:08 PM »
We have a fairly solid use of network file servers in our district. We can create bookmarks so that students can access the drive quickly, but I wanted to see if we could have the same convenience of our windows mapped network folders. I have added a couple of scripts to automount a public student folder. This also means that there is no need to do any Libre Office work around, as LibreOffice can directly save into the server with this setup.

First I booted with -generic instead of -aufs to make the changes permanent. Then I made sure samba and smbfs was installed:
sudo apt-get install samba
sudo apt-get install smbfs

Then I created a folder to mount the network folder
sudo mkdir /media/server

Then in the file:
/etc/network/if-up.d/mynetstart

I added:
mount -t smbfs //our-server/folder /media/server -o uid=1000,gid=1000,umask=0022,username="generic-student-account",password=""

This means that when a network connection is established the server will be mounted. This works fine, but it wasn't shutting down due to the fact that the wireless was turning off before the folder was unmounted.

So I created a file called S15umount in /etc/rc0.d:

sudo gedit /etc/rc0.d/S15umount
 
with this text:
#!/bin/sh
sudo umount /media/server

and then made the file executable:
sudo chmod a+x S15umount

This works more times but not all the time, so it still hangs on shutdown. Any ideas or suggestions on how to fine tune this auto-mount process would be great. Once it is working perfectly I will post to the wiki.

jnetman1

  • Administrator
  • Hero Member
  • *****
  • Posts: 285
    • View Profile
Re: Network File Storage
« Reply #1 on: April 04, 2012, 09:07:35 AM »
A couple thoughts: It seems the easiest way to make this work would be to create a bookmark in the file manager (nautilus). To do that:
  • Open any folder
  • Go to File->Connect to Server
  • Enter all of the credentials and check the "Add Bookmark" and give it a sensible name, like "Server"
  • When prompted for a password, choose "Remember forever"
Then every time they click the bookmark, it will automatically handle the attach, and disconnect properly.

If you want to stay on your path, then there are a few other possibilities (one of which should work):
  • Add your umount script to /etc/network/if-down.d in the same fashion as you did up (might work)
  • Create a .bash_logout script in the home folder with your logout command (be sure to make it executable).
  • Add the command to /etc/gdm/PostSession/Default

Hope this helps!