Announcement

Collapse
No announcement yet.

How to use Amazon Cloud Drive to store & access unlimited encrypted media with Ubuntu

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use Amazon Cloud Drive to store & access unlimited encrypted media with Ubuntu

    In my case, I use this in conjunction with Plex, but you can use this however you like.

    First, you need a few things:

    1. An Amazon Cloud Drive account.
    2. An Ubuntu 14.04 or greater server with root access.
    3. A user account, which I will call “user” in this tutorial with sudo privileges.
    4. Access to connect to the desktop of your Ubuntu server (if you don't have this, Google "noMachine")


    Where I use the username “user”, substitute with whatever username you are using.
    Where I use “~” in a directory name, I assume it to be “/home/use”r (again, in this case user is whatever username you are using)

    Start by setting up your folders:
    Code:
    cd ~
    mkdir .acd
    mkdir acd
    mkdir .local_media
    mkdir local_media
    mkdir media
    mkdir scripts
    mkdir scripts/logs
    What these folders are for:
    ~/.acd – ACD mount has your encrypted files
    ~/acd – ACD mount has your decrypted files with EncFS
    ~/.local_files – local files after being encrypted by EncFS
    ~/local_files – where you will copy everything that will be encrypted and sent to ACD
    ~/media – the UnionFS mount point t hatmerges ‘~/acd’ and ‘~/local’ directories.
    ~/scripts - for automating our EncFS folder mounts
    ~/scripts/logs - logs for the scripts.

    Setup rClone
    Code:
    cd ~/Downloads
    wget http://downloads.rclone.org/rclone-current-linux-amd64.zip
    unzip rclone-current-linux-amd64.zip
    cd rclone-*-linux-amd64
    sudo cp rclone /usr/sbin/
    sudo chown root:root /usr/sbin/rclone
    sudo chmod 755 /usr/sbin/rclone
    sudo mkdir -p /usr/local/share/man/man1
    sudo cp rclone.1 /usr/local/share/man/man1/
    sudo mandb
    Now you need to have to be connected to the desktop of your ubuntu machine, as you will need to open a browser on localhost at one point. In terminal on the actual server, enter:
    Code:
    rclone config
    1. Enter “n” to add a new remote connection
    2. Name your instance "acd"
    3. Enter “1” for ACD
    4. Accept the defaults for the following two fiends.
    5. Enter “y” to use the “automatic” mode.


    At this point, your browser will open to Amazon. Login with your username and password for your ACD account and login, then go back to your terminal window.. You should now see a bunch of characters that represent your token, and a question asking if is is there.

    Enter "y" to accept this.
    Then enter "q" to exit

    From this point on, you don't need to be on the local server, and can SSH in as the user if you like.

    In Terminal;:
    Code:
    rclone listremotes
    You should see acd if everything worked so far.

    Mount your ACD Drive:
    Code:
    rclone mount acd:user /home/user/.acd &
    Setup EncFS:
    Code:
    sudo apt-get install -y encfs
    encfs /home/user/.local_files /home/user/local_files
    Use the default encryption settings and choose a good password.

    Setup Folders you will encrypt:
    For this tutorial, we will just make a folder for tv.

    Code:
    cd ~/local_files
    mkdir tv
    Now we will make sure it worked.

    Code:
    ls ~/local_files
    You should see the tv folder in there.
    Code:
    ls ~/.local_files
    In here, you should see a folder with a bunch of random characters. This is your encrypted tv folder.

    Now we will unmound the drive so we can move the setting file and encrypt the folders with EncFS config files.
    Code:
    umount -l /home/user/local_files
    mv /home/user/.local_files/.encfs6.xml  /home/user/encfs.xml
    ENCFS6_CONFIG='/home/user/encfs.xml' encfs /home/user/.local_files /home/user/local_files
    ENCFS6_CONFIG='/home/user/encfs.xml' encfs /home/user/.acd /home/user/acd

    Merge Our folders with UnionFS-Fuse
    Code:
    sudo apt-get install -y unionfs-fuse
    unionfs-fuse -o cow /home/user/local_files=RW:/home/user/acd=RO /home/user/media/
    Automatically Mount everything at boot
    Code:
    cd ~
    cd scripts
    nano encfspass
    Enter the EncFS password you created above, then save the file by entering CTRL+X” and “Y”
    Code:
    chmod +x encfspass
    nano mount.sh
    Copy and paste the following into mount,sh, then save the file by entering CTRL+X” and “Y”
    Code:
    #!/bin/sh
    /bin/fusermount -uz /home/user/acd
    /bin/fusermount -uz /home/user/.acd
    /bin/fusermount -uz /home/user/.local_files
    /bin/fusermount -uz /home/user/media
    /usr/sbin/rclone mount acd:user /home/user/.acd &
    ENCFS6_CONFIG='/home/user/encfs.xml' encfs --extpass="cat /home/user/scripts/encfspass" /home/user/.acd /home/user/acd
    ENCFS6_CONFIG='/home/user/encfs.xml' encfs --extpass="cat /home/user/scripts/encfspass" /home/user/.local_files /home/plex/local_files
    unionfs-fuse -o cow /home/user/local_files=RW:/home/user/acd=RO /home/plex/media
    exit
    Now make the script executable:
    Code:
    chmod +x mount.sh
    and add the script to crontab:
    Code:
    crontab -e
    When opening crontab, choose "2" to use nano for your editor, then go to the very bottom of the file and copy and paste the following, then save the file by entering CTRL+X” and “Y”
    Code:
     [MENTION=125818]Reboot[/MENTION] /home/user/scripts/mount.sh > /home/user/scripts/logs/mount.log 2>&1
    Now reboot and make sure it all goes well.

    Wrap Up

    Now let's say you want to copy some tv shows into ACD, encrypt them=, and make them accessible to something like Plex or Kodi. You would copy the shows with whatever folder structure you want into the ~/local_files folder. Once you do this, execute:

    Code:
    rclone copy /home/user/.local_files acd:user
    Once you have done this, you will see that references are in your ~/media folder. You can add that folder to Plex or Kodi and you will be set.

    You can also delete from the local drive when done as follows:
    Code:
    rm -Rf "/home/user/local_files/tv/“*
    Caveats
    So assuming you are using this for the same reasons as I do -- streaming TV and movies on plex from a nice unlimited Amazon Cloud drive. How will this work? You will be streaming from ACD to your Ubuntu server, decrypting, then streaming to your local device. In my case, this is all on a seedbox. So, to keep from adding the load to the seedbox and to remove the middle layer, I have a local server on an Intel NUC, and copy the same configuration files to my local computer, have Plex installed on it, and sync the contents of my ~/media folder between the seedbox and my local server. This way, I can use the seedbox to get everything onto ACD, but leave it out of the process when I am actually streaming.

    Hope this helps



  • #2
    [MENTION=364392]mkov[/MENTION] Nice! How much does Amazon Cloud Drive cost?

    Comment


    • #3
      [MENTION=286651]stb[/MENTION], it is $60 a year for unlimited space. But if you already have Dropbox, Onedrive, etc., you can still do the same thing with those. in the step where you are on the localhost and run rclone config, instead of choosing "1" for ACD, pick the service you want. And obviously to make it clear, in all the places I write to use "acd", you may want to change that to something that is more clear like "db" for dropbox.

      Comment


      • #4
        Unlimited - sounds too good :D. I wonder, what if download like 100+ BluRay movies to the drive :D.

        Comment


        • #5
          ACD does impose a lot of restrictions on the type of files, and how the service is used. But in encrypting everything, I think it just looks like it is being used as a backup service. So far I have had no problems, and worst case scenario, it was $60

          Comment


          • #6
            Damn, I was thinking of buying ~8TB hdd for archiving. Now I am thinking... guess what :D. Btw, can I make a seedbox out of this drive?

            Comment


            • #7
              Haven't tried, but I have seen trackers say that you will get penalized if you use a cloud drive for seeding. I think it messes something up.

              Comment


              • #8
                You mean penalized by drive or tracker?

                Comment


                • #9
                  Potentially both.

                  Comment

                  Working...
                  X