Skip to content

multiple users per host in ~/.netrc not working #8241

@manfredsc

Description

@manfredsc

Curl does not use different credentials on this:

  curl -n ftp://foouser@example.com
  curl -n ftp://baruser@example.com

Almost all clients (wget, lftp, ftp, ...) pick the matching entry out of ~/.netrc,
but curl just takes the first ~/.netrc entry for "example.com".

Or, as a standalone example, using http:

cat > curl.netrc <<EOF
machine example.com
login foouser
password foouser

machine example.com
login baruser
password baruser
EOF

#> curl -qsS --netrc-file curl.netrc --trace-ascii - http://baruser@example.com | grep "user"
== Info: Server auth using Basic with user 'foouser'
#> curl -qsS --netrc-file curl.netrc --trace-ascii - http://foouser@example.com | grep "user"
== Info: Server auth using Basic with user 'foouser'

curl/libcurl version

curl 7.79.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions