github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/docs/content/mega.md (about) 1 --- 2 title: "Mega" 3 description: "Rclone docs for Mega" 4 versionIntroduced: "v1.41" 5 --- 6 7 # {{< icon "fa fa-archive" >}} Mega 8 9 [Mega](https://mega.nz/) is a cloud storage and file hosting service 10 known for its security feature where all files are encrypted locally 11 before they are uploaded. This prevents anyone (including employees of 12 Mega) from accessing the files without knowledge of the key used for 13 encryption. 14 15 This is an rclone backend for Mega which supports the file transfer 16 features of Mega using the same client side encryption. 17 18 Paths are specified as `remote:path` 19 20 Paths may be as deep as required, e.g. `remote:directory/subdirectory`. 21 22 ## Configuration 23 24 Here is an example of how to make a remote called `remote`. First run: 25 26 rclone config 27 28 This will guide you through an interactive setup process: 29 30 ``` 31 No remotes found, make a new one? 32 n) New remote 33 s) Set configuration password 34 q) Quit config 35 n/s/q> n 36 name> remote 37 Type of storage to configure. 38 Choose a number from below, or type in your own value 39 [snip] 40 XX / Mega 41 \ "mega" 42 [snip] 43 Storage> mega 44 User name 45 user> you@example.com 46 Password. 47 y) Yes type in my own password 48 g) Generate random password 49 n) No leave this optional password blank 50 y/g/n> y 51 Enter the password: 52 password: 53 Confirm the password: 54 password: 55 Remote config 56 -------------------- 57 [remote] 58 type = mega 59 user = you@example.com 60 pass = *** ENCRYPTED *** 61 -------------------- 62 y) Yes this is OK 63 e) Edit this remote 64 d) Delete this remote 65 y/e/d> y 66 ``` 67 68 **NOTE:** The encryption keys need to have been already generated after a regular login 69 via the browser, otherwise attempting to use the credentials in `rclone` will fail. 70 71 Once configured you can then use `rclone` like this, 72 73 List directories in top level of your Mega 74 75 rclone lsd remote: 76 77 List all the files in your Mega 78 79 rclone ls remote: 80 81 To copy a local directory to an Mega directory called backup 82 83 rclone copy /home/source remote:backup 84 85 ### Modification times and hashes 86 87 Mega does not support modification times or hashes yet. 88 89 ### Restricted filename characters 90 91 | Character | Value | Replacement | 92 | --------- |:-----:|:-----------:| 93 | NUL | 0x00 | ␀ | 94 | / | 0x2F | / | 95 96 Invalid UTF-8 bytes will also be [replaced](/overview/#invalid-utf8), 97 as they can't be used in JSON strings. 98 99 ### Duplicated files 100 101 Mega can have two files with exactly the same name and path (unlike a 102 normal file system). 103 104 Duplicated files cause problems with the syncing and you will see 105 messages in the log about duplicates. 106 107 Use `rclone dedupe` to fix duplicated files. 108 109 ### Failure to log-in 110 111 #### Object not found 112 113 If you are connecting to your Mega remote for the first time, 114 to test access and synchronization, you may receive an error such as 115 116 ``` 117 Failed to create file system for "my-mega-remote:": 118 couldn't login: Object (typically, node or user) not found 119 ``` 120 121 The diagnostic steps often recommended in the [rclone forum](https://forum.rclone.org/search?q=mega) 122 start with the **MEGAcmd** utility. Note that this refers to 123 the official C++ command from https://github.com/meganz/MEGAcmd 124 and not the go language built command from t3rm1n4l/megacmd 125 that is no longer maintained. 126 127 Follow the instructions for installing MEGAcmd and try accessing 128 your remote as they recommend. You can establish whether or not 129 you can log in using MEGAcmd, and obtain diagnostic information 130 to help you, and search or work with others in the forum. 131 132 ``` 133 MEGA CMD> login me@example.com 134 Password: 135 Fetching nodes ... 136 Loading transfers from local cache 137 Login complete as me@example.com 138 me@example.com:/$ 139 ``` 140 141 Note that some have found issues with passwords containing special 142 characters. If you can not log on with rclone, but MEGAcmd logs on 143 just fine, then consider changing your password temporarily to 144 pure alphanumeric characters, in case that helps. 145 146 147 #### Repeated commands blocks access 148 149 Mega remotes seem to get blocked (reject logins) under "heavy use". 150 We haven't worked out the exact blocking rules but it seems to be 151 related to fast paced, successive rclone commands. 152 153 For example, executing this command 90 times in a row `rclone link 154 remote:file` will cause the remote to become "blocked". This is not an 155 abnormal situation, for example if you wish to get the public links of 156 a directory with hundred of files... After more or less a week, the 157 remote will remote accept rclone logins normally again. 158 159 You can mitigate this issue by mounting the remote it with `rclone 160 mount`. This will log-in when mounting and a log-out when unmounting 161 only. You can also run `rclone rcd` and then use `rclone rc` to run 162 the commands over the API to avoid logging in each time. 163 164 Rclone does not currently close mega sessions (you can see them in the 165 web interface), however closing the sessions does not solve the issue. 166 167 If you space rclone commands by 3 seconds it will avoid blocking the 168 remote. We haven't identified the exact blocking rules, so perhaps one 169 could execute the command 80 times without waiting and avoid blocking 170 by waiting 3 seconds, then continuing... 171 172 Note that this has been observed by trial and error and might not be 173 set in stone. 174 175 Other tools seem not to produce this blocking effect, as they use a 176 different working approach (state-based, using sessionIDs instead of 177 log-in) which isn't compatible with the current stateless rclone 178 approach. 179 180 Note that once blocked, the use of other tools (such as megacmd) is 181 not a sure workaround: following megacmd login times have been 182 observed in succession for blocked remote: 7 minutes, 20 min, 30min, 30 183 min, 30min. Web access looks unaffected though. 184 185 Investigation is continuing in relation to workarounds based on 186 timeouts, pacers, retrials and tpslimits - if you discover something 187 relevant, please post on the forum. 188 189 So, if rclone was working nicely and suddenly you are unable to log-in 190 and you are sure the user and the password are correct, likely you 191 have got the remote blocked for a while. 192 193 {{< rem autogenerated options start" - DO NOT EDIT - instead edit fs.RegInfo in backend/mega/mega.go then run make backenddocs" >}} 194 ### Standard options 195 196 Here are the Standard options specific to mega (Mega). 197 198 #### --mega-user 199 200 User name. 201 202 Properties: 203 204 - Config: user 205 - Env Var: RCLONE_MEGA_USER 206 - Type: string 207 - Required: true 208 209 #### --mega-pass 210 211 Password. 212 213 **NB** Input to this must be obscured - see [rclone obscure](/commands/rclone_obscure/). 214 215 Properties: 216 217 - Config: pass 218 - Env Var: RCLONE_MEGA_PASS 219 - Type: string 220 - Required: true 221 222 ### Advanced options 223 224 Here are the Advanced options specific to mega (Mega). 225 226 #### --mega-debug 227 228 Output more debug from Mega. 229 230 If this flag is set (along with -vv) it will print further debugging 231 information from the mega backend. 232 233 Properties: 234 235 - Config: debug 236 - Env Var: RCLONE_MEGA_DEBUG 237 - Type: bool 238 - Default: false 239 240 #### --mega-hard-delete 241 242 Delete files permanently rather than putting them into the trash. 243 244 Normally the mega backend will put all deletions into the trash rather 245 than permanently deleting them. If you specify this then rclone will 246 permanently delete objects instead. 247 248 Properties: 249 250 - Config: hard_delete 251 - Env Var: RCLONE_MEGA_HARD_DELETE 252 - Type: bool 253 - Default: false 254 255 #### --mega-use-https 256 257 Use HTTPS for transfers. 258 259 MEGA uses plain text HTTP connections by default. 260 Some ISPs throttle HTTP connections, this causes transfers to become very slow. 261 Enabling this will force MEGA to use HTTPS for all transfers. 262 HTTPS is normally not necessary since all data is already encrypted anyway. 263 Enabling it will increase CPU usage and add network overhead. 264 265 Properties: 266 267 - Config: use_https 268 - Env Var: RCLONE_MEGA_USE_HTTPS 269 - Type: bool 270 - Default: false 271 272 #### --mega-encoding 273 274 The encoding for the backend. 275 276 See the [encoding section in the overview](/overview/#encoding) for more info. 277 278 Properties: 279 280 - Config: encoding 281 - Env Var: RCLONE_MEGA_ENCODING 282 - Type: Encoding 283 - Default: Slash,InvalidUtf8,Dot 284 285 #### --mega-description 286 287 Description of the remote 288 289 Properties: 290 291 - Config: description 292 - Env Var: RCLONE_MEGA_DESCRIPTION 293 - Type: string 294 - Required: false 295 296 {{< rem autogenerated options stop >}} 297 298 ### Process `killed` 299 300 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). 301 302 ## Limitations 303 304 This backend uses the [go-mega go library](https://github.com/t3rm1n4l/go-mega) which is an opensource 305 go library implementing the Mega API. There doesn't appear to be any 306 documentation for the mega protocol beyond the [mega C++ SDK](https://github.com/meganz/sdk) source code 307 so there are likely quite a few errors still remaining in this library. 308 309 Mega allows duplicate files which may confuse rclone.