github.com/xhghs/rclone@v1.51.1-0.20200430155106-e186a28cced8/docs/content/mega.md (about)

     1  ---
     2  title: "Mega"
     3  description: "Rclone docs for Mega"
     4  date: "2018-04-09"
     5  ---
     6  
     7  <i class="fa fa-archive"></i> Mega
     8  -----------------------------------------
     9  
    10  [Mega](https://mega.nz/) is a cloud storage and file hosting service
    11  known for its security feature where all files are encrypted locally
    12  before they are uploaded. This prevents anyone (including employees of
    13  Mega) from accessing the files without knowledge of the key used for
    14  encryption.
    15  
    16  This is an rclone backend for Mega which supports the file transfer
    17  features of Mega using the same client side encryption.
    18  
    19  Paths are specified as `remote:path`
    20  
    21  Paths may be as deep as required, eg `remote:directory/subdirectory`.
    22  
    23  Here is an example of how to make a remote called `remote`.  First run:
    24  
    25       rclone config
    26  
    27  This will guide you through an interactive setup process:
    28  
    29  ```
    30  No remotes found - make a new one
    31  n) New remote
    32  s) Set configuration password
    33  q) Quit config
    34  n/s/q> n
    35  name> remote
    36  Type of storage to configure.
    37  Choose a number from below, or type in your own value
    38  [snip]
    39  XX / Mega
    40     \ "mega"
    41  [snip]
    42  Storage> mega
    43  User name
    44  user> you@example.com
    45  Password.
    46  y) Yes type in my own password
    47  g) Generate random password
    48  n) No leave this optional password blank
    49  y/g/n> y
    50  Enter the password:
    51  password:
    52  Confirm the password:
    53  password:
    54  Remote config
    55  --------------------
    56  [remote]
    57  type = mega
    58  user = you@example.com
    59  pass = *** ENCRYPTED ***
    60  --------------------
    61  y) Yes this is OK
    62  e) Edit this remote
    63  d) Delete this remote
    64  y/e/d> y
    65  ```
    66  
    67  **NOTE:** The encryption keys need to have been already generated after a regular login
    68  via the browser, otherwise attempting to use the credentials in `rclone` will fail.
    69  
    70  Once configured you can then use `rclone` like this,
    71  
    72  List directories in top level of your Mega
    73  
    74      rclone lsd remote:
    75  
    76  List all the files in your Mega
    77  
    78      rclone ls remote:
    79  
    80  To copy a local directory to an Mega directory called backup
    81  
    82      rclone copy /home/source remote:backup
    83  
    84  ### Modified time and hashes ###
    85  
    86  Mega does not support modification times or hashes yet.
    87  
    88  #### Restricted filename characters
    89  
    90  | Character | Value | Replacement |
    91  | --------- |:-----:|:-----------:|
    92  | NUL       | 0x00  | ␀           |
    93  | /         | 0x2F  | /          |
    94  
    95  Invalid UTF-8 bytes will also be [replaced](/overview/#invalid-utf8),
    96  as they can't be used in JSON strings.
    97  
    98  ### Duplicated files ###
    99  
   100  Mega can have two files with exactly the same name and path (unlike a
   101  normal file system).
   102  
   103  Duplicated files cause problems with the syncing and you will see
   104  messages in the log about duplicates.
   105  
   106  Use `rclone dedupe` to fix duplicated files.
   107  
   108  ### Failure to log-in ###
   109  
   110  Mega remotes seem to get blocked (reject logins) under "heavy use".
   111  We haven't worked out the exact blocking rules but it seems to be
   112  related to fast paced, sucessive rclone commands.
   113  
   114  For example, executing this command 90 times in a row `rclone link
   115  remote:file` will cause the remote to become "blocked". This is not an
   116  abnormal situation, for example if you wish to get the public links of
   117  a directory with hundred of files...  After more or less a week, the
   118  remote will remote accept rclone logins normally again.
   119  
   120  You can mitigate this issue by mounting the remote it with `rclone
   121  mount`. This will log-in when mounting and a log-out when unmounting
   122  only. You can also run `rclone rcd` and then use `rclone rc` to run
   123  the commands over the API to avoid logging in each time.
   124  
   125  Rclone does not currently close mega sessions (you can see them in the
   126  web interface), however closing the sessions does not solve the issue.
   127  
   128  If you space rclone commands by 3 seconds it will avoid blocking the
   129  remote. We haven't identified the exact blocking rules, so perhaps one
   130  could execute the command 80 times without waiting and avoid blocking
   131  by waiting 3 seconds, then continuing...
   132  
   133  Note that this has been observed by trial and error and might not be
   134  set in stone.
   135  
   136  Other tools seem not to produce this blocking effect, as they use a
   137  different working approach (state-based, using sessionIDs instead of
   138  log-in) which isn't compatible with the current stateless rclone
   139  approach.
   140  
   141  Note that once blocked, the use of other tools (such as megacmd) is
   142  not a sure workaround: following megacmd login times have been
   143  observed in sucession for blocked remote: 7 minutes, 20 min, 30min, 30
   144  min, 30min. Web access looks unaffected though.
   145  
   146  Investigation is continuing in relation to workarounds based on
   147  timeouts, pacers, retrials and tpslimits - if you discover something
   148  relevant, please post on the forum.
   149  
   150  So, if rclone was working nicely and suddenly you are unable to log-in
   151  and you are sure the user and the password are correct, likely you
   152  have got the remote blocked for a while.
   153  
   154  <!--- autogenerated options start - DO NOT EDIT, instead edit fs.RegInfo in backend/mega/mega.go then run make backenddocs -->
   155  ### Standard Options
   156  
   157  Here are the standard options specific to mega (Mega).
   158  
   159  #### --mega-user
   160  
   161  User name
   162  
   163  - Config:      user
   164  - Env Var:     RCLONE_MEGA_USER
   165  - Type:        string
   166  - Default:     ""
   167  
   168  #### --mega-pass
   169  
   170  Password.
   171  
   172  - Config:      pass
   173  - Env Var:     RCLONE_MEGA_PASS
   174  - Type:        string
   175  - Default:     ""
   176  
   177  ### Advanced Options
   178  
   179  Here are the advanced options specific to mega (Mega).
   180  
   181  #### --mega-debug
   182  
   183  Output more debug from Mega.
   184  
   185  If this flag is set (along with -vv) it will print further debugging
   186  information from the mega backend.
   187  
   188  - Config:      debug
   189  - Env Var:     RCLONE_MEGA_DEBUG
   190  - Type:        bool
   191  - Default:     false
   192  
   193  #### --mega-hard-delete
   194  
   195  Delete files permanently rather than putting them into the trash.
   196  
   197  Normally the mega backend will put all deletions into the trash rather
   198  than permanently deleting them.  If you specify this then rclone will
   199  permanently delete objects instead.
   200  
   201  - Config:      hard_delete
   202  - Env Var:     RCLONE_MEGA_HARD_DELETE
   203  - Type:        bool
   204  - Default:     false
   205  
   206  #### --mega-encoding
   207  
   208  This sets the encoding for the backend.
   209  
   210  See: the [encoding section in the overview](/overview/#encoding) for more info.
   211  
   212  - Config:      encoding
   213  - Env Var:     RCLONE_MEGA_ENCODING
   214  - Type:        MultiEncoder
   215  - Default:     Slash,InvalidUtf8,Dot
   216  
   217  <!--- autogenerated options stop -->
   218  
   219  ### Limitations ###
   220  
   221  This backend uses the [go-mega go library](https://github.com/t3rm1n4l/go-mega) which is an opensource
   222  go library implementing the Mega API. There doesn't appear to be any
   223  documentation for the mega protocol beyond the [mega C++ SDK](https://github.com/meganz/sdk) source code
   224  so there are likely quite a few errors still remaining in this library.
   225  
   226  Mega allows duplicate files which may confuse rclone.