[Cloudtools APKG HOW-TO] Mega

User avatar
father.mande
Posts: 1819
youtube meble na wymiar Warszawa
Joined: Sat Sep 12, 2015 2:55 am
Location: La Rochelle (France)

[Cloudtools APKG HOW-TO] Mega

Post by father.mande »

Hi,

This is a series of messages to explain usage for each cloud target using cloudtools command line or mount tools
Please for support use the "PRODUCT" forum and help
... the source code of the program have not been changed in any manner (except if difference is listed here ... in fact only for Bash interface)

[Mega]
prerequisite : NOTHING

Set of tools :
tools to download "exported" mega file : megadl THIS don't require to have a mega account ...
... an exported file is a link (URL) with the KEY (data are encrypted) or without
... URL with a key can be downloaded directly
... URL without key require that you know the key (send you by owner using another way) ... requested by megadl ...

tools to work with your own account
... this require to supply your account (email / password)
... to do this 3 solutions ...
... ... 1 : put user and password as parameters in the command (each time) BUT this appear in clear in Linux survey tools like "ps"
... ... ... if you have more than one account ... easy way to change target even from a unique Asustor user
... ... 2 : create a .megarc (don't forget the . (point) at start of the file) under the HOME folder of the user
... ... ... so if you connect you as root (or use cron job, etc.) ... it's under /root/ ; if you use admin it's /home/admin/
... ... ... even if you know what you do ... use a specific Asustor user (need shadow-su package from Entware-ng APKG) so it's /home/user/
YOU CAN HAVE different account per user
... ... 3 : create like 2 a .megarc ... put it in any place and use the "--config file" argument with each command (so it's hide the account in survey tools)

IN ALL CASE be sure that .megarc is r (read) only for the user to have security (password is in clear text)

Code: Select all

root@AS5002TaPhil:/volume1/.@root # ll .megarc
-r--------    1 root     root          59 May 21 18:45 .megarc
root@AS5002TaPhil:/volume1/.@root #
megacopy ... nearest way as synchronization tools per directory
megaget / megaput ... download / upload files
megals / megarm / megamkdir ... file list with (-l) date of deposit, size, etc... / remove mega files / create remote folder
megareg ... register a NEW user in mega site
megadf ... global info on space used and free

.megarc example is provide in cloudtools folder ( /usr/local/AppCentral/cloudtools )

Code: Select all

root@AS5002TaPhil:/volume1/.@plugins/AppCentral/cloudtools # cat .megarc.sample
[Login]
Username = your.email@provider.ext
Password = your_password_unfortunately_in_clear_so_control_access_right_for_this_file
root@AS5002TaPhil:/volume1/.@plugins/AppCentral/cloudtools #
tools to mount mega structure in the Linux structure
megafs ... BUT IRRELEVANT for normal use (at this time) ... only read the file tree and able to remove files ... NO read NO write
... so this it's clearly reserved for specific usage
AS any Fuse network mount ... you can access the mount only using locals tools NOR by default using php, or java in web tools or Samba, etc. ... (due to the fact that folder appear as null (siize 0) files)

Philippe.
AS6602T / AS5202T /AS5002T / AS1002T / FS6706T
damien599901
Posts: 575
Joined: Mon Dec 30, 2013 2:53 am

Re: [Cloudtools APKG HOW-TO] Mega

Post by damien599901 »

Hi Philippe

thank you so much for this topic and these explanations !

Could please explain more step by step how to proceed?
"YOU CAN HAVE different account per user
... ... 3 : create like 2 a .megarc ... put it in any place and use the "--config file" argument with each command (so it's hide the account in survey tools)"
Storage: AS7004T & AS5002T
Network: FREEBOX REVOLUTION V6
Laptop: Apple MACBOOK Pro OS X El Capitan & Windows 10
Media Player: ASUSTOR NAS with Kodi 16 Beta & HD_Engine 1 (thanks Fathe_Mande)
Portable: iPhone 6S Plus, iPad Mini 2 & iPad Air
User avatar
father.mande
Posts: 1819
Joined: Sat Sep 12, 2015 2:55 am
Location: La Rochelle (France)

Re: [Cloudtools APKG HOW-TO] Mega

Post by father.mande »

Hi,
damien599901 wrote: Could please explain more step by step how to proceed?
"YOU CAN HAVE different account per user
... ... 3 : create like 2 a .megarc ... put it in any place and use the "--config file" argument with each command (so it's hide the account in survey tools)"
Each Cloud ... need a minimum of knowledge on how it works ...
Each command line tools need to have some knowledge on the structure of the Linux ... AND MORE IMPORTANT ... you must understand the command and options according to the Cloud (here Mega) rules ...

A Mega account is an email associated to a password
... so you can have multiple account (on Mega)

A Linux user (like admin or root) have a HOME folder ( /root/ and /home/admin/ respectively)
... if you put the .megarc file (with Mega account) in the HOME folder as it's the best way for a single account ... you can't have a second file with same name ...
... so creating a my_second_megarc file (in HOME or other place) permit to have in a second account
... in this case using the command line tools need to precise that you want to use the new file and not the default .megarc file
... ALL command for mega accept a specific option to precise where are the file to use for the Mega account (another possibility is to put in clear text the email and password of the account ... but for me it's too insecure)

Another way is to use the su command (available in Entware-ng) to switch to another user name in Asustor ... and have FOR THIS USER a .megarc in its HOME folder ...

The biggest (even needing some works to understand) advantage of Linux is that you have always multiple solutions for a same question or problem ... :lol:

Philippe.
NB Please I don't want to be 100% complete ... my topic is for a first approach ... so you can have a more complete information in official developer site and forum
AS6602T / AS5202T /AS5002T / AS1002T / FS6706T
damien599901
Posts: 575
Joined: Mon Dec 30, 2013 2:53 am

Re: [Cloudtools APKG HOW-TO] Mega

Post by damien599901 »

i see
Issue : a .megarc file is considered like a "file system" on my macbook :cry: and is hidden ...
Storage: AS7004T & AS5002T
Network: FREEBOX REVOLUTION V6
Laptop: Apple MACBOOK Pro OS X El Capitan & Windows 10
Media Player: ASUSTOR NAS with Kodi 16 Beta & HD_Engine 1 (thanks Fathe_Mande)
Portable: iPhone 6S Plus, iPad Mini 2 & iPad Air
User avatar
father.mande
Posts: 1819
Joined: Sat Sep 12, 2015 2:55 am
Location: La Rochelle (France)

Re: [Cloudtools APKG HOW-TO] Mega

Post by father.mande »

Hi,
damien599901 wrote:i see
Issue : a .megarc file is considered like a "file system" on my macbook :cry: and is hidden ...
YES any file starting with . is ... to be hide from a lot of tools ... so a little more secure ...
.xxx is the method used to hide a file in Linux ...

Generally you have a parameters to see the hidden files ...

Philippe.
AS6602T / AS5202T /AS5002T / AS1002T / FS6706T
damien599901
Posts: 575
Joined: Mon Dec 30, 2013 2:53 am

Re: [Cloudtools APKG HOW-TO] Mega

Post by damien599901 »

error message "ERROR: You must specify your mega.nz username (email)"

i dont understand how mount and how synchronize with Mega ...

i can read this megafs [-o <options>…] [-d] [-f] <mountpoint> ?
Storage: AS7004T & AS5002T
Network: FREEBOX REVOLUTION V6
Laptop: Apple MACBOOK Pro OS X El Capitan & Windows 10
Media Player: ASUSTOR NAS with Kodi 16 Beta & HD_Engine 1 (thanks Fathe_Mande)
Portable: iPhone 6S Plus, iPad Mini 2 & iPad Air
User avatar
father.mande
Posts: 1819
Joined: Sat Sep 12, 2015 2:55 am
Location: La Rochelle (France)

Re: [Cloudtools APKG HOW-TO] Mega

Post by father.mande »

Hi,

To connect you to Mega ... you need an account (it's an email and a password) and you need to put this account in a .megarc file following the syntax of the sample ...

megafs is NOT to be used (as write in the topic) because it's ONLY for reading the structure and remove (NO read NO write) ... so it's reserved for future used and specific case ...

you can get or put file
download link for Public or private exported file (this can be done with exported URL even you don't have account in mega (try one of my APKG for ex.)

The nearest command (near synchronize) is megacopy that works at folder level to clone sole folder (not the root)

Philippe.
AS6602T / AS5202T /AS5002T / AS1002T / FS6706T
damien599901
Posts: 575
Joined: Mon Dec 30, 2013 2:53 am

Re: [Cloudtools APKG HOW-TO] Mega

Post by damien599901 »

father.mande wrote:Hi,

To connect you to Mega ... you need an account (it's an email and a password) and you need to put this account in a .megarc file following the syntax of the sample ...
Hi Philippe,

i ve created an account. it works. But what do you mean by "put this account in a .megarc file following the syntax of the sample"?
i can edit without issue the .megaarc.sample file with the vi command but i can't edit the .megarc file
Strange

.megarc file can be e.g. in /share/Public ?
Storage: AS7004T & AS5002T
Network: FREEBOX REVOLUTION V6
Laptop: Apple MACBOOK Pro OS X El Capitan & Windows 10
Media Player: ASUSTOR NAS with Kodi 16 Beta & HD_Engine 1 (thanks Fathe_Mande)
Portable: iPhone 6S Plus, iPad Mini 2 & iPad Air
User avatar
father.mande
Posts: 1819
Joined: Sat Sep 12, 2015 2:55 am
Location: La Rochelle (France)

Re: [Cloudtools APKG HOW-TO] Mega

Post by father.mande »

Hi,

by default megatool search for the .megarc file in the HOME folder of the user
so if you are logged with root it is : /root/ ... with admin : /home/admin/

but you can put this file in any place if for each command (except megadl that don't use credentials but exported, by you or other, URL) you use : --config=PATH ... where PATH is the full path to your own megarc file (any name are accepted for the file)
you can also add you account value directly using -u and -p options ... so no usage pf megarc file ...

if you create a .megarc ... the best idea is to set access right to 400 (read only for the owner) so nobody can read (or change) value except you (but after setting correct access rigth)
... it's a security need by the fact the password is in clear text ...

sample files are only provide to show you the syntax ... and for hubicfuse to show you, also, interesting extended parameters ... it's NOT to use it at all ...

Philippe.
AS6602T / AS5202T /AS5002T / AS1002T / FS6706T
damien599901
Posts: 575
Joined: Mon Dec 30, 2013 2:53 am

Re: [Cloudtools APKG HOW-TO] Mega

Post by damien599901 »

father.mande wrote:Hi,

by default megatool search for the .megarc file in the HOME folder of the user
so if you are logged with root it is : /root/ ... with admin : /home/admin/

but you can put this file in any place if for each command (except megadl that don't use credentials but exported, by you or other, URL) you use : --config=PATH ... where PATH is the full path to your own megarc file (any name are accepted for the file)
you can also add you account value directly using -u and -p options ... so no usage pf megarc file ...

if you create a .megarc ... the best idea is to set access right to 400 (read only for the owner) so nobody can read (or change) value except you (but after setting correct access rigth)
... it's a security need by the fact the password is in clear text ...

sample files are only provide to show you the syntax ... and for hubicfuse to show you, also, interesting extended parameters ... it's NOT to use it at all ...

Philippe.
Hi Philippe

ok thanks
in your script is it possible or not : create the .megarc file with or without choice of the folder?

cheers
Damien
Storage: AS7004T & AS5002T
Network: FREEBOX REVOLUTION V6
Laptop: Apple MACBOOK Pro OS X El Capitan & Windows 10
Media Player: ASUSTOR NAS with Kodi 16 Beta & HD_Engine 1 (thanks Fathe_Mande)
Portable: iPhone 6S Plus, iPad Mini 2 & iPad Air
Post Reply

Return to “Cloodtools”