xref: /curl/docs/cmdline-opts/user.md (revision 6e494a23)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Long: user
5Short: u
6Arg: <user:password>
7Help: Server user and password
8Category: important auth
9Added: 4.0
10Multi: single
11See-also:
12  - netrc
13  - config
14Example:
15  - -u user:secret $URL
16---
17
18# `--user`
19
20Specify the username and password to use for server authentication. Overrides
21--netrc and --netrc-optional.
22
23If you simply specify the username, curl prompts for a password.
24
25The username and passwords are split up on the first colon, which makes it
26impossible to use a colon in the username with this option. The password can,
27still.
28
29On systems where it works, curl hides the given option argument from process
30listings. This is not enough to protect credentials from possibly getting seen
31by other users on the same system as they still are visible for a moment
32before cleared. Such sensitive data should be retrieved from a file instead or
33similar and never used in clear text in a command line.
34
35When using Kerberos V5 with a Windows based server you should include the
36Windows domain name in the username, in order for the server to successfully
37obtain a Kerberos Ticket. If you do not, then the initial authentication
38handshake may fail.
39
40When using NTLM, the username can be specified simply as the username, without
41the domain, if there is a single domain and forest in your setup for example.
42
43To specify the domain name use either Down-Level Logon Name or UPN (User
44Principal Name) formats. For example, EXAMPLE\user and user@example.com
45respectively.
46
47If you use a Windows SSPI-enabled curl binary and perform Kerberos V5,
48Negotiate, NTLM or Digest authentication then you can tell curl to select the
49username and password from your environment by specifying a single colon with
50this option: "-u :".
51