Questions tagged [.netrc]

The .netrc file contains data for logging in to a remote host over the network for file transfers by `ftp`

Purpose

Specifies automatic login information for the ftp and rexec commands.

Description

The $HOME/.netrc file contains information used by the automatic login feature of the rexec and ftp commands. It is a hidden file in a user's home directory and must be owned either by the user executing the command or by the root user. If the .netrc file contains a login password, the file's permissions must be set to 600 (read and write by owner only). This file is part of TCP/IP in Network Support Facilities.

Note:
The .netrc file is not used by any programs when the securetcpip command is running on your system. The .netrc can contain the following entries (separated by spaces, tabs, or new lines):

machine HostName     The HostName variable is the name of a remote host.
                     This entry begins the definition of the automatic login process 
                     for the specified host. All following entries up to the next 
                     machine entry or the end of the file apply to that host.

default              The default variable is the same as machine except that default 
                     matches any name. There can be only one default entry. It must be 
                     the last entry (after all machine entries); otherwise, entries 
                     that follow it will be ignored. This is normally used as:
                                     "default login anonymous password user@site"
                     thereby giving the user automatic anonymous ftp login to machines 
                     not specified in the .netrc file. This can be overridden by using 
                     the -n flag to disable the auto-login.

login UserName       The UserName variable is the full domain user name for use at the
                     remote host. If this entry is found, the automatic login process
                     initiates a login, using the specified name. If this entry is 
                     missing, the automatic login process is unsuccessful.

password Password    The Password variable is the login password to be used.
                     The automatic login process supplies this password to the remote 
                     server. A login password must be established at the remote host, 
                     and that password must be entered in the .netrc file. Otherwise 
                     the automatic login process is unsuccessful, and the user is 
                     prompted for the login password.

account Password     The Password variable is the account password to be used.
                     If this entry is found and an account password is required at the 
                     remote host, the automatic login process supplies the password to 
                     the remote server. If the remote host requires an account
                     password but this entry is missing, the automatic login process 
                     prompts for the account password.

macdef MacroName     The MacroName variable is the name of an ftp subcommand macro.
                     The macro is defined to contain all of the following ftp 
                     subcommands up to the next blank line or the end of the file. If 
                     the macro is named init, the ftp command executes the macro upon 
                     successful completion of the automatic login process. The rexec 
                     command does not recognize a macdef entry.
53 questions
19
votes
8 answers

Cocoapods - Error installing Mapbox-iOS-SDK

I want to install last version of Mapbox with Cocoapods. I configure .netrc file : machine api.mapbox.com login mapbox password But when I launch pod install, I have this error : [!] Error installing Mapbox-iOS-SDK [!]…
BSK-Team
  • 1,750
  • 1
  • 19
  • 37
11
votes
6 answers

Specify password to sftp in a Bash script

I am trying to write a script to back up a file over SFTP. The problem is, it requires a password, and I see no way to manually specify a password to SFTP. I've heard about requiring no password by using public keys, but that requires being able to…
Eli
  • 636
  • 2
  • 7
  • 17
11
votes
2 answers

Git .netrc file authentication issue

I am using GitHub. I created a repository and cloned it on my Ubuntu machine. I have made an entry in the .netrc file as follows: machine https://github.com/xxx/yyy.git login xxx xxx I am expecting that Git will not ask me for the username and…
Arul Selvam
  • 125
  • 1
  • 1
  • 9
10
votes
3 answers

Can _netrc handle passphrases with spaces?

The following configuration works: machine code.mycompany.net login supernerd password HelloW0rld The following configuration doesn't work: machine code.mycompany.net login supernerd password Please excuse my dear aunt sally.
Tom Norton
  • 751
  • 1
  • 8
  • 19
9
votes
2 answers

Can I add comments to a .netrc file?

I'm using a .netrc file to steamline pushing and pulling code int a git repository. The problem is, I'm using multiple tenants on the same host, with different credentials. I was thinking about commenting out blocs in the .netrc file, depending on…
9
votes
1 answer

_netrc/.netrc alternative to cURL

I've been looking at Git and cURL and I found some references about .netrc, that may help on HTTP authentication. The problem is: .netrc is dumb, because it stores passwords in plain text format, which is a big security issue for the solution I'm…
Herberth Amaral
  • 3,479
  • 3
  • 33
  • 35
7
votes
2 answers

File '_netrc' / '.netrc' is not accepted by Git

I have set the %HOME% environment variable on my Windows installation. In that folder I have put a file called _netrc. Inside that file I have: machine code.google.com login password But both, MSYS and Tortoise keep asking for a…
user852830
7
votes
1 answer

Purpose of the '.netrc' file

When I try to use Google Cloud's Push-to-Deploy feature, they asked me to add some credential in the .netrc file. What is the .netrc file? What is the purpose?
Fizer Khan
  • 88,237
  • 28
  • 143
  • 153
6
votes
0 answers

Downloading Binary-only Swift Packages that require authentication

I am using the Swift Package Manager that is built into Xcode 13.1 (not the command line version that uses Package.swift). One of my dependencies is a Binary-only package. Here is what the Package.swift of that package looks like: //…
Moshe Katz
  • 15,992
  • 7
  • 69
  • 116
5
votes
2 answers

How to attach .netrc file to python requests get method?

I am trying to login to a site using python requests. Normally I do this using curl in the cmd. curl -c -n -L https://site_FileUpload/login Where the -n searches for the .netrc file in the cwd which contains my username and…
TechnoTerry
  • 65
  • 2
  • 6
5
votes
1 answer

How to authenticate Github on Ubuntu? git: 'credential-netrc' is not a git command

I read this and I have checked my credentials,still I can not git push. git push --set-upstream origin master git: 'credential-netrc' is not a git command. See 'git --help'. What I have done so far: Created ~/.netrc gpg --gen-key gpg -e -r…
Richard Rublev
  • 7,718
  • 16
  • 77
  • 121
5
votes
2 answers

Heroku CLI login is failing with error "Error: ENOENT: no such file or directory, open 'H:/_netrc'"

I have installed Heroku CLI on Windows, Facing below failure while logging in: Error: ENOENT: no such file or directory, open 'H:/_netrc' heroku/7.41.1 win32-x64 node-v12.16.2 C:\Windows\system32>heroku login heroku: Press any key to open up the…
Sagar
  • 71
  • 2
  • 3
4
votes
0 answers

Use .netrc with pip and gitlab pypi

We have a gitlab pypi repository and a package that can be installed with the following command pip install mypackage \ --extra-index-url https://__token__:z-u5aFNdakdlsN@gitlab.com/api/v4/projects/12345678/packages/pypi/simple I try to follow…
phi
  • 10,572
  • 3
  • 21
  • 30
4
votes
2 answers

How to authenticate Databrics API using .netrc file

I have created ".netrc " file on my machine and trying below databricks rest api call. But it always giving an unauthorized error. How to create .netrc file in Databricks? curl -n -X GET https:///api/2.0/token/list How to use .netrc file with…
Rohi_Dev_1.0
  • 372
  • 1
  • 2
  • 19
3
votes
5 answers

jenkins git plugin http auth .netrc

since the last update of jenkins and the git plugin the http auth via .netrc does not work anymore. I really checked many many threads about this issue. I tried to use also the variant http://user:pass@url.tld/repo.git which works. But internally…
maTu
  • 289
  • 1
  • 3
  • 10
1
2 3 4