Announcement

Collapse
No announcement yet.

Connect to network drive on startup and sync/backup docs folder to network?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Connect to network drive on startup and sync/backup docs folder to network?

    Hi. Although I've been using kubuntu for years, I'm still not quite at the point where I can do advanced things with confidence, and googling seems to have failed me on this one...or maybe I failed google.

    I run kubuntu 11.04 on my main laptop, and ubuntu 11.04 (64-bit) on my netbook. I'm trying to set things up so that when I turn on the computer, a connection to my home server automagically happens. I currently use sshfs and do it manually from the command line.

    I'd like to also set up some type of job to run that automagically backs up my home/Documents folder to the home server once a day, either upon shutdown, or upon my putting the computer to sleep.

    I have read scripting tutorials, but all the n00b-friendly ones I've found are several years old. I need someone to point me to a place where I can learn in small syllables and child-oriented metaphors because I just don't seem to be getting this. If your dog or your school-age kid can understand it, then it's probably at the level I need.

    Is there someone who will take pity on my brain-fail?

    thanks in advance!
    Jensoko

    #2
    Re: Connect to network drive on startup and sync/backup docs folder to network?

    Are you asking how to automate an SSH connection?

    That's relatively simple.

    Edit a script (using kate, for example) that contains your usual SSH connection command string and name it something like

    ssh_at_bootup.sh

    You must make it executable (either tick the executable box for the permissions using Dolphin or from the command line:

    sudo chmod +x ssh_at_bootup.sh

    Then link the executable script file into your Autostart folder:

    sudo ln -s /pathtofile/bootup.sh ~/.kde/Autostart

    or add the script to the Autostart options using the System Settings GUI:
    K menu -> Settings -> System Settings -> Advanced -> Autostart -> Add Script...


    Or are you really wanting to set up a VPN connection so that your mobile laptop can be part of your home network?

    In that case you could always go out and buy a router with a VPN server already built into it (there are some Linksys/Cisco routers these days with that capability, about $100-$125, I think).

    Or you could set up an OpenVPN server on a computer on your network and allow VPN passthrough by your router to the computer with the OpenVPN server on it. (That takes a little effort to set up, though.)

    Once you have a VPN server set up, your computer would need a VPN client. For this you probably want Kvpnc for Kubuntu. (The alternative if you still are using (K)Network Manager is the VPN connection part of Network Manager).




    UbuntuGuide/KubuntuGuide

    Right now the killer is being surrounded by a web of deduction, forensic science,
    and the latest in technology such as two-way radios and e-mail.

    Comment


      #3
      Re: Connect to network drive on startup and sync/backup docs folder to network?

      The autostart script sounds like what I want to do in order to automate the connection to my home server. I don't need a VPN or anything like that--just a way to map my home network drive to the mobile laptop when I'm connected to my home server.

      The other thing I want to do is to make a script that backs up my home/documents folder to my server, and automate it to activate before I put my computer to sleep.

      In essence, I guess what I'm trying to do is make my home server work like Dropbox - I can change my dropbox folder from any computer and it will auto-sync with the others. Am I overreaching here?

      Thanks so much for the help!

      Jen

      Comment


        #4
        Re: Connect to network drive on startup and sync/backup docs folder to network?

        look in to a program called "back in time" or just search "backup" in the package manager you will find some gui programs to do it (ms.sith uses back in time cause its ez for her to use all gui controlled)
        Mark Your Solved Issues [SOLVED]
        (top of thread: thread tools)

        Comment


          #5
          Re: Connect to network drive on startup and sync/backup docs folder to network?

          Originally posted by jensoko
          --just a way to map my home network drive to the mobile laptop when I'm connected to my home server.

          The other thing I want to do is to make a script that backs up my home/documents folder to my server, and automate it to activate before I put my computer to sleep.

          In essence, I guess what I'm trying to do is make my home server work like Dropbox - I can change my dropbox folder from any computer and it will auto-sync with the others. Am I overreaching here?
          You really need to define a bit more accurately what exactly you want/expect to do.

          I am assuming you want to have your documents and media (music, videos, photos) synced but not settings. I also assume dropbox is too small (2gb) for your needs?

          You could write a small cron script to use rsync, rdiff-backup, or lucky backup to detect connection to server and when detected do the deed. rsync will work but is plain-jane. rdiff-backup can do incremental and two-way backups easier. I never messed with lucky backup but it looks OK.

          EDIT: rdiff-backup can also test to see if your server is on so it would handle the detection all by itself.

          Please Read Me

          Comment


            #6
            Re: Connect to network drive on startup and sync/backup docs folder to network?

            i forgot

            Originally posted by backintime-kde description
            Back In Time is a framework for rsync, diff and cron for the purpose of taking snapshots and backups of specified folders. It minimizes disk space use by taking a snapshot only if the directory has been changed, and hard links for unmodified files if it has. The user can schedule regular backups using cron.

            This is the KDE front-end for the backintime-common package.
            Mark Your Solved Issues [SOLVED]
            (top of thread: thread tools)

            Comment


              #7
              Re: Connect to network drive on startup and sync/backup docs folder to network?

              Hi, jensoko -

              There's only one way to eat an elephant - one bite at a time

              You've got at least three different requirements here and I think maybe that's why the task is a little overwhelming so maybe breaking it down into smaller tasks would make things easier. Your requirements as I understand them are -

              1. To connect to a network share automatically,

              2. To sync your documents on suspend, and

              3. To sync your documents on shutdown.

              I listed 2 and 3 separately as the way to do them is different. You can use the same script to do them but the script has to be called in different ways depending on whether it's being called by powerdevil or by a shutdown script.

              Although ssh will do what you want I think rsync over NFS might do a better job because unless you want to feed ssh a password every time the script runs you'll need to configure sshd on the server to accept certificate-based logins and maintain a certificate on the client machine - plus, rsync will be faster and use less bandwidth. Also, rsync will be a little more intelligent about what to copy and what to skip

              Okay. First thing to do is create the NFS shares on the server. You'll need to install portmap, nfs-common and nfs-kernel-server. Once that's done you identify the directories you want to be able to access from remote in /etc/exports - mine looks like this:

              # /etc/exports: the access control list for filesystems which may be exported
              # to NFS clients. See exports(5).
              #
              # Example for NFSv2 and NFSv3:
              # /srv/homes hostname1(rw,sync) hostname2(ro,sync)
              #
              # Example for NFSv4:
              # /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt)
              # /srv/nfs4/homes gss/krb5i(rw,sync)

              /home/wizard 192.168.1.0/255.255.255.0(rw,sync,no_subtree_check)
              /etc 192.168.1.0/255.255.255.0(rw,sync,no_subtree_check)

              Note that I make my home directory and /etc available to any client on my local network. Yours would look more like this but the network IP address may be different and should end in zero so the share is avaialble to the whole network -

              /home/username/Documents 192.168.1.0/255.255.255.0(rw,sync,no_subtree_check)

              After you're done editing /etc/exports you'll either need to restart portmap or reboot the machine to make the shares available.

              To mount the share temporarily for testing the easiest way is probably to create a mount point on the client machine - so if you'd create a directory under /mnt called Documents you can temporarily mount the server share like this -

              sudo mount ip.address.of.server:/home/username/Documents /mnt/Documents

              Once you get the share working we can look at mounting it automatically. Why don't you get NFS working and we'll go from there.

              cheers -

              we see things not as they are, but as we are.
              -- anais nin

              Comment


                #8
                Re: Connect to network drive on startup and sync/backup docs folder to network?

                Dropbox? No way.

                I would never store my files on someone else's server.

                Dropbox does an analysis of uploaded files (ostensibly to check for duplicates or verboten types of files) and has other security problems, which is somewhat inherent to all remote hosting solutions.

                It is far better to learn how to make your own files remotely accessible in a secure fashion and not throw your hat in with a lot of other users and trust someone else to keep your files from being accessed, hacked, examined, or, er, "relocated' somewhere beyond your control.

                A quick way of keeping network folders is WebDAV. You can set a folder that is accessible on your network to also be a WebDAV folder.

                I think it is wise to not make one of your main folders accessible in anyway directly to the Internet.

                It is better to have a web-accessible folder that independently syncs with one of your networks main folders, and then remote users would only sync to the web-accessible folder. That way you have a bit of a buffer in case someone manages to get into your web-accessible folder (how do you think all the hacking occurs these days?)

                +1 for Rsync and NFS over SSH (or VPN) as the alternative to WebDAV, but it is a lot more effort.


                UbuntuGuide/KubuntuGuide

                Right now the killer is being surrounded by a web of deduction, forensic science,
                and the latest in technology such as two-way radios and e-mail.

                Comment


                  #9
                  Re: Connect to network drive on startup and sync/backup docs folder to network?

                  Originally posted by perspectoff
                  Dropbox? No way.

                  I would never store my files on someone else's server.
                  Dropbox just got hammered for letting slip that at least some of their technicians had access to user encryption keys - I figure Carbonite probably does too.

                  Scary stuff.
                  we see things not as they are, but as we are.
                  -- anais nin

                  Comment


                    #10
                    Re: Connect to network drive on startup and sync/backup docs folder to network?

                    wizard10000: Thank you so very very much for helping me break this down. And it does feel like I'm eating an elephant!

                    After my mobile netbook's hard drive developed a hairball that rendered it nonfunctional, I started using Dropbox to keep my document files (and it's only documents and sometimes photos, so the Dropbox size is fine). But with the recent shenanigans, I'd just feel better keeping things on my home server.

                    I'm going to start with NFS. I may already have it working - I have a home directory on my home network that I use sshfs to log into, and mount points that I use under the /mnt directory.

                    Comment


                      #11
                      Re: Connect to network drive on startup and sync/backup docs folder to network?

                      NFS is really easy (compared to SAMBA) but currently no GUI tool to set it up.

                      If you need help - let us know.

                      Please Read Me

                      Comment

                      Working...
                      X