2017-10-15 10:45:39 +00:00
---
title: "Mega"
description: "Rclone docs for Mega"
2022-11-17 17:56:24 +00:00
versionIntroduced: "v1.41"
2017-10-15 10:45:39 +00:00
---
2021-07-20 18:45:41 +00:00
# {{< icon "fa fa-archive" >}} Mega
2017-10-15 10:45:39 +00:00
[Mega ](https://mega.nz/ ) is a cloud storage and file hosting service
known for its security feature where all files are encrypted locally
before they are uploaded. This prevents anyone (including employees of
Mega) from accessing the files without knowledge of the key used for
encryption.
This is an rclone backend for Mega which supports the file transfer
features of Mega using the same client side encryption.
Paths are specified as `remote:path`
2020-10-13 21:49:58 +00:00
Paths may be as deep as required, e.g. `remote:directory/subdirectory` .
2017-10-15 10:45:39 +00:00
2021-10-14 13:40:18 +00:00
## Configuration
2017-10-15 10:45:39 +00:00
Here is an example of how to make a remote called `remote` . First run:
rclone config
This will guide you through an interactive setup process:
```
2021-11-01 20:34:46 +00:00
No remotes found, make a new one?
2017-10-15 10:45:39 +00:00
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> remote
Type of storage to configure.
Choose a number from below, or type in your own value
[snip]
2019-08-26 09:47:17 +00:00
XX / Mega
2017-10-15 10:45:39 +00:00
\ "mega"
[snip]
Storage> mega
User name
user> you@example.com
Password.
y) Yes type in my own password
g) Generate random password
n) No leave this optional password blank
y/g/n> y
Enter the password:
password:
Confirm the password:
password:
Remote config
2024-08-16 10:05:43 +00:00
Configuration complete.
Options:
- type: mega
- user: you@example.com
- pass: ** * ENCRYPTED ** *
Keep this "remote" remote?
2017-10-15 10:45:39 +00:00
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
```
2018-10-25 11:25:05 +00:00
**NOTE:** The encryption keys need to have been already generated after a regular login
via the browser, otherwise attempting to use the credentials in `rclone` will fail.
2017-10-15 10:45:39 +00:00
Once configured you can then use `rclone` like this,
List directories in top level of your Mega
rclone lsd remote:
List all the files in your Mega
rclone ls remote:
To copy a local directory to an Mega directory called backup
rclone copy /home/source remote:backup
2023-11-18 12:36:46 +00:00
### Modification times and hashes
2017-10-15 10:45:39 +00:00
Mega does not support modification times or hashes yet.
2021-10-14 13:40:18 +00:00
### Restricted filename characters
2018-11-02 12:14:55 +00:00
| Character | Value | Replacement |
| --------- |:-----:|:-----------:|
| NUL | 0x00 | ␀ |
| / | 0x2F | / |
Invalid UTF-8 bytes will also be [replaced ](/overview/#invalid-utf8 ),
as they can't be used in JSON strings.
2021-10-14 13:40:18 +00:00
### Duplicated files
2017-10-15 10:45:39 +00:00
Mega can have two files with exactly the same name and path (unlike a
normal file system).
Duplicated files cause problems with the syncing and you will see
messages in the log about duplicates.
Use `rclone dedupe` to fix duplicated files.
2021-10-14 13:40:18 +00:00
### Failure to log-in
2019-05-16 09:10:58 +00:00
2022-06-14 08:55:40 +00:00
#### Object not found
If you are connecting to your Mega remote for the first time,
2022-08-14 02:56:32 +00:00
to test access and synchronization, you may receive an error such as
2022-06-14 08:55:40 +00:00
```
Failed to create file system for "my-mega-remote:":
couldn't login: Object (typically, node or user) not found
```
The diagnostic steps often recommended in the [rclone forum ](https://forum.rclone.org/search?q=mega )
start with the **MEGAcmd** utility. Note that this refers to
the official C++ command from https://github.com/meganz/MEGAcmd
and not the go language built command from t3rm1n4l/megacmd
that is no longer maintained.
Follow the instructions for installing MEGAcmd and try accessing
your remote as they recommend. You can establish whether or not
you can log in using MEGAcmd, and obtain diagnostic information
to help you, and search or work with others in the forum.
```
MEGA CMD> login me@example.com
Password:
Fetching nodes ...
Loading transfers from local cache
Login complete as me@example.com
me@example.com:/$
```
Note that some have found issues with passwords containing special
characters. If you can not log on with rclone, but MEGAcmd logs on
just fine, then consider changing your password temporarily to
pure alphanumeric characters, in case that helps.
#### Repeated commands blocks access
2019-05-16 09:10:58 +00:00
Mega remotes seem to get blocked (reject logins) under "heavy use".
We haven't worked out the exact blocking rules but it seems to be
2020-05-19 11:02:44 +00:00
related to fast paced, successive rclone commands.
2019-05-16 09:10:58 +00:00
For example, executing this command 90 times in a row `rclone link
remote:file` will cause the remote to become "blocked". This is not an
abnormal situation, for example if you wish to get the public links of
a directory with hundred of files... After more or less a week, the
remote will remote accept rclone logins normally again.
2019-05-29 16:37:53 +00:00
You can mitigate this issue by mounting the remote it with `rclone
mount`. This will log-in when mounting and a log-out when unmounting
only. You can also run `rclone rcd` and then use `rclone rc` to run
the commands over the API to avoid logging in each time.
2019-05-16 09:10:58 +00:00
Rclone does not currently close mega sessions (you can see them in the
web interface), however closing the sessions does not solve the issue.
If you space rclone commands by 3 seconds it will avoid blocking the
remote. We haven't identified the exact blocking rules, so perhaps one
could execute the command 80 times without waiting and avoid blocking
by waiting 3 seconds, then continuing...
Note that this has been observed by trial and error and might not be
set in stone.
Other tools seem not to produce this blocking effect, as they use a
different working approach (state-based, using sessionIDs instead of
log-in) which isn't compatible with the current stateless rclone
approach.
Note that once blocked, the use of other tools (such as megacmd) is
not a sure workaround: following megacmd login times have been
2020-05-19 11:02:44 +00:00
observed in succession for blocked remote: 7 minutes, 20 min, 30min, 30
2019-05-16 09:10:58 +00:00
min, 30min. Web access looks unaffected though.
Investigation is continuing in relation to workarounds based on
timeouts, pacers, retrials and tpslimits - if you discover something
relevant, please post on the forum.
So, if rclone was working nicely and suddenly you are unable to log-in
and you are sure the user and the password are correct, likely you
have got the remote blocked for a while.
2020-05-22 11:22:52 +00:00
{{< rem autogenerated options start " - DO NOT EDIT - instead edit fs . RegInfo in backend / mega / mega . go then run make backenddocs " > }}
2021-11-01 15:42:05 +00:00
### Standard options
2018-10-01 19:48:54 +00:00
2022-07-09 17:08:20 +00:00
Here are the Standard options specific to mega (Mega).
2018-10-01 19:48:54 +00:00
#### --mega-user
2021-11-01 15:42:05 +00:00
User name.
2018-10-01 19:48:54 +00:00
2022-03-18 12:29:54 +00:00
Properties:
2018-10-01 19:48:54 +00:00
- Config: user
- Env Var: RCLONE_MEGA_USER
- Type: string
2022-03-18 12:29:54 +00:00
- Required: true
2018-10-01 19:48:54 +00:00
#### --mega-pass
Password.
2020-09-02 15:59:04 +00:00
**NB** Input to this must be obscured - see [rclone obscure ](/commands/rclone_obscure/ ).
2022-03-18 12:29:54 +00:00
Properties:
2018-10-01 19:48:54 +00:00
- Config: pass
- Env Var: RCLONE_MEGA_PASS
- Type: string
2022-03-18 12:29:54 +00:00
- Required: true
2018-10-01 19:48:54 +00:00
2021-11-01 15:42:05 +00:00
### Advanced options
2018-10-01 19:48:54 +00:00
2022-07-09 17:08:20 +00:00
Here are the Advanced options specific to mega (Mega).
2018-10-01 19:48:54 +00:00
#### --mega-debug
Output more debug from Mega.
If this flag is set (along with -vv) it will print further debugging
information from the mega backend.
2022-03-18 12:29:54 +00:00
Properties:
2018-10-01 19:48:54 +00:00
- Config: debug
- Env Var: RCLONE_MEGA_DEBUG
- Type: bool
- Default: false
#### --mega-hard-delete
Delete files permanently rather than putting them into the trash.
Normally the mega backend will put all deletions into the trash rather
than permanently deleting them. If you specify this then rclone will
permanently delete objects instead.
2022-03-18 12:29:54 +00:00
Properties:
2018-10-01 19:48:54 +00:00
- Config: hard_delete
- Env Var: RCLONE_MEGA_HARD_DELETE
- Type: bool
- Default: false
2023-03-14 12:16:30 +00:00
#### --mega-use-https
Use HTTPS for transfers.
MEGA uses plain text HTTP connections by default.
Some ISPs throttle HTTP connections, this causes transfers to become very slow.
Enabling this will force MEGA to use HTTPS for all transfers.
2023-03-24 13:31:39 +00:00
HTTPS is normally not necessary since all data is already encrypted anyway.
2023-03-14 12:16:30 +00:00
Enabling it will increase CPU usage and add network overhead.
Properties:
- Config: use_https
- Env Var: RCLONE_MEGA_USE_HTTPS
- Type: bool
- Default: false
2020-02-01 10:31:42 +00:00
#### --mega-encoding
2022-03-18 12:29:54 +00:00
The encoding for the backend.
2020-02-01 10:31:42 +00:00
2021-11-01 15:42:05 +00:00
See the [encoding section in the overview ](/overview/#encoding ) for more info.
2020-02-01 10:31:42 +00:00
2022-03-18 12:29:54 +00:00
Properties:
2020-02-01 10:31:42 +00:00
- Config: encoding
- Env Var: RCLONE_MEGA_ENCODING
2023-11-26 15:59:12 +00:00
- Type: Encoding
2020-02-01 10:31:42 +00:00
- Default: Slash,InvalidUtf8,Dot
2024-03-10 11:22:43 +00:00
#### --mega-description
2024-06-14 15:04:51 +00:00
Description of the remote.
2024-03-10 11:22:43 +00:00
Properties:
- Config: description
- Env Var: RCLONE_MEGA_DESCRIPTION
- Type: string
- Required: false
2020-05-22 11:22:52 +00:00
{{< rem autogenerated options stop > }}
2018-08-01 12:44:19 +00:00
2023-07-25 03:21:37 +00:00
### Process `killed`
On accounts with large files or something else, memory usage can significantly increase when executing list/sync instructions. When running on cloud providers (like AWS with EC2), check if the instance type has sufficient memory/CPU to execute the commands. Use the resource monitoring tools to inspect after sending the commands. Look [at this issue ](https://forum.rclone.org/t/rclone-with-mega-appears-to-work-only-in-some-accounts/40233/4 ).
2021-10-14 13:40:18 +00:00
## Limitations
2017-10-15 10:45:39 +00:00
2018-10-25 11:25:05 +00:00
This backend uses the [go-mega go library ](https://github.com/t3rm1n4l/go-mega ) which is an opensource
2017-10-15 10:45:39 +00:00
go library implementing the Mega API. There doesn't appear to be any
2018-10-25 11:25:05 +00:00
documentation for the mega protocol beyond the [mega C++ SDK ](https://github.com/meganz/sdk ) source code
so there are likely quite a few errors still remaining in this library.
2017-10-15 10:45:39 +00:00
Mega allows duplicate files which may confuse rclone.