xref: /aosp_15_r20/external/curl/docs/cmdline-opts/netrc.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker---
2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al.
3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl
4*6236dae4SAndroid Build Coastguard WorkerLong: netrc
5*6236dae4SAndroid Build Coastguard WorkerShort: n
6*6236dae4SAndroid Build Coastguard WorkerHelp: Must read .netrc for username and password
7*6236dae4SAndroid Build Coastguard WorkerCategory: auth
8*6236dae4SAndroid Build Coastguard WorkerAdded: 4.6
9*6236dae4SAndroid Build Coastguard WorkerMutexed: netrc-file netrc-optional
10*6236dae4SAndroid Build Coastguard WorkerMulti: boolean
11*6236dae4SAndroid Build Coastguard WorkerSee-also:
12*6236dae4SAndroid Build Coastguard Worker  - netrc-file
13*6236dae4SAndroid Build Coastguard Worker  - config
14*6236dae4SAndroid Build Coastguard Worker  - user
15*6236dae4SAndroid Build Coastguard WorkerExample:
16*6236dae4SAndroid Build Coastguard Worker  - --netrc $URL
17*6236dae4SAndroid Build Coastguard Worker---
18*6236dae4SAndroid Build Coastguard Worker
19*6236dae4SAndroid Build Coastguard Worker# `--netrc`
20*6236dae4SAndroid Build Coastguard Worker
21*6236dae4SAndroid Build Coastguard WorkerMake curl scan the *.netrc* file in the user's home directory for login name
22*6236dae4SAndroid Build Coastguard Workerand password. This is typically used for FTP on Unix. If used with HTTP, curl
23*6236dae4SAndroid Build Coastguard Workerenables user authentication. See *netrc(5)* and *ftp(1)* for details on the
24*6236dae4SAndroid Build Coastguard Workerfile format. Curl does not complain if that file does not have the right
25*6236dae4SAndroid Build Coastguard Workerpermissions (it should be neither world- nor group-readable). The environment
26*6236dae4SAndroid Build Coastguard Workervariable "HOME" is used to find the home directory.
27*6236dae4SAndroid Build Coastguard Worker
28*6236dae4SAndroid Build Coastguard WorkerOn Windows two filenames in the home directory are checked: *.netrc* and
29*6236dae4SAndroid Build Coastguard Worker*_netrc*, preferring the former. Older versions on Windows checked for *_netrc*
30*6236dae4SAndroid Build Coastguard Workeronly.
31*6236dae4SAndroid Build Coastguard Worker
32*6236dae4SAndroid Build Coastguard WorkerA quick and simple example of how to setup a *.netrc* to allow curl to FTP to
33*6236dae4SAndroid Build Coastguard Workerthe machine host.domain.com with username 'myself' and password 'secret' could
34*6236dae4SAndroid Build Coastguard Workerlook similar to:
35*6236dae4SAndroid Build Coastguard Worker
36*6236dae4SAndroid Build Coastguard Worker    machine host.domain.com
37*6236dae4SAndroid Build Coastguard Worker    login myself
38*6236dae4SAndroid Build Coastguard Worker    password secret
39