xref: /curl/docs/cmdline-opts/netrc.md (revision 2abfc759)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Long: netrc
5Short: n
6Help: Must read .netrc for username and password
7Category: auth
8Added: 4.6
9Mutexed: netrc-file netrc-optional
10Multi: boolean
11See-also:
12  - netrc-file
13  - config
14  - user
15Example:
16  - --netrc $URL
17---
18
19# `--netrc`
20
21Make curl scan the *.netrc* file in the user's home directory for login name
22and password. This is typically used for FTP on Unix. If used with HTTP, curl
23enables user authentication. See *netrc(5)* and *ftp(1)* for details on the
24file format. Curl does not complain if that file does not have the right
25permissions (it should be neither world- nor group-readable). The environment
26variable "HOME" is used to find the home directory.
27
28On Windows two filenames in the home directory are checked: *.netrc* and
29*_netrc*, preferring the former. Older versions on Windows checked for *_netrc*
30only.
31
32A quick and simple example of how to setup a *.netrc* to allow curl to FTP to
33the machine host.domain.com with username 'myself' and password 'secret' could
34look similar to:
35
36    machine host.domain.com
37    login myself
38    password secret
39