megarc(5)
=========

NAME
----
megarc - Configuration file for megatools


SYNOPSIS
--------
[verse]
'./.megarc'
'~/.megarc'


DESCRIPTION
-----------

Megatools read commonly used login credentials and settings from an INI
file. This makes the tools less bothersome to use, as you can simply write

--------
$ megatools df
--------

instead of

--------
$ megatools df --username my@email.com --password mypass
--------

Megatools use the first of these files that exists:

. the file given with `--config <path>`
. `.megarc` in the current directory
. `.megarc` in your home directory

On Windows, the file is called `mega.ini` instead of `.megarc`. With
`--ignore-config-file`, no file is read (unless `--config` is given too).
Options given on the command line override the settings from the file.

A `.megarc` in the current directory is only used when it belongs to you and
other users can't write it (otherwise it is ignored with a warning), and a
notice says that it is used. This keeps a directory prepared by someone else
from logging you in to their account or sending your traffic through their
proxy.

The file can contain your password, so it should only be readable by you
(`chmod 600 ~/.megarc`); megatools warns when a file with a password or 2FA
secret is readable by other users.


FILE FORMAT
-----------

The file consists of `[Section]` lines followed by `Name = value` lines.
Lines starting with `#` are comments (a `#` after a value is part of the
value). All sections and settings are optional. Section and setting names
are case sensitive, thus you must write `[Login]`, and not `[login]`, and
so on.

Spaces before the value are dropped, spaces at its end are kept (watch for
them after a password). A backslash starts an escape sequence (`\n` is
a new line, `\t` a tab): write `\\` for a backslash and `\s` for a space at
the start of the value. For example, the password `my\nice\password` is
written as `my\\nice\\password`.

Boolean values are `true` or `false`.


[Login] Section
~~~~~~~~~~~~~~~

Username::
	Your account's email address.

Password::
	Your password (see FILE FORMAT for backslashes). When it's missing,
	megatools asks for it on the terminal.

TwoFactorSecret::
	Two-factor authentication secret (base32), megatools generates the
	login codes from it. See '--2fa-secret' and man:megatools-2fa[1].
	Ignored when '--2fa-code' or '--2fa-secret' is given.


[Cache] Section
~~~~~~~~~~~~~~~

Timeout::
	How long the list of remote files in the session cache is used, in
	seconds (default 600, i.e. 10 minutes). After that it is fetched again
	from the server; the session itself is still reused. 0 means the
	list never times out (use `--reload` to refresh it). See SESSION
	CACHE in man:megatools[1].


[Network] Section
~~~~~~~~~~~~~~~~~

SpeedLimit::
	Maximum upload and download speed in KiB/s. 0 means no limit (the
	default).

UploadSpeedLimit::
	Maximum upload speed in KiB/s, overrides `SpeedLimit`. 0 means no
	limit. The limit applies to each of the `ParallelTransfers`
	connections.

DownloadSpeedLimit::
	Maximum download speed in KiB/s, overrides `SpeedLimit`. 0 means no
	limit.

ParallelTransfers::
	Number of connections used to upload a file (1 to 16, default 5).
	The file is split into chunks of 128 KiB to 1 MiB, which are
	uploaded in parallel. More is not always faster. Downloads use one
	connection.

Proxy::
	Proxy server to use for all connections, as for the `--proxy`
	option. The value is passed to libcurl, see
	link:https://curl.se/libcurl/c/CURLOPT_PROXY.html[]. Examples:
+
	* `http://proxy.example.com:3128`: HTTP proxy
	* `socks5://localhost:9050`: SOCKSv5 proxy (Tor), the names are
	  resolved locally
	* `socks5h://localhost:9050`: SOCKSv5 proxy, the names are resolved by
	  the proxy


[Upload] Section
~~~~~~~~~~~~~~~~

CreatePreviews::
	`true` (the default) or `false`: whether to generate and upload
	previews (thumbnails) of uploaded images and videos. See
	`--enable-previews` and `--disable-previews`.


[UI] Section
~~~~~~~~~~~~

Colors::
	`true` to use colors in the progress reports (when the output is a
	terminal). Colors are disabled by default to support all kinds of
	terminal configurations. They are not configurable.


EXAMPLE
-------

Create `~/.megarc` (`mega.ini` in your user profile directory on Windows):

------------
[Login]
Username = your@email
Password = yourpassword

[Network]
# 1 MiB/s
SpeedLimit = 1024
# Use over Tor
Proxy = socks5h://127.0.0.1:9050
ParallelTransfers = 2

[UI]
Colors = true
------------

Run man:megatools-df[1] to check that megatools are able to login to your
account:

------------
$ chmod 600 ~/.megarc
$ megatools df -h
------------


include::footer.txt[]
