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
3
votes
1 answer

Git authentication for perl CGI-Script via .netrc

I've got a little perl-script which attempts to pull from a git repository and then gets some things from git log: use Git::Repository; my $repo = Git::Repository->new( git_dir => $git_path, ); $repo->run('pull') || die $!; my @commits…
Vince
  • 1,517
  • 2
  • 18
  • 43
2
votes
2 answers

How to download Mapbox iOS SDK 6.0 and later w/ cocoapods

I tried just changing the pod file to have the version '6.1.0' but it ended up giving the error seen below: [!] Error installing Mapbox-iOS-SDK [!] /usr/bin/curl -f -L -o…
nickcoding
  • 305
  • 8
  • 35
2
votes
1 answer

Ssh key on github

Whenever I want to commit something on my repository, I have to type ssh-add ~/.ssh/my_git_key_file Is there a way to not do that every time I want to commit something? I want to use a .netrc file with this inside instead of the ssh keys: machine…
Paul Banus
  • 27
  • 7
2
votes
2 answers

Python .netrc error on file with comment

I have the following: import netrc machine = 'ftp.example.com' auth = netrc.netrc().authenticators(machine) I have the following line in my .netrc file: machine "### comment" I get the following error: netrc.NetrcParseError: bad follower token…
runrig
  • 6,486
  • 2
  • 27
  • 44
2
votes
0 answers

Autocompletion from .netrc in Emacs

I use Emacs at work and at home, both on Windows XP, both EmacsW32. On my work computer, if I setup FTP login details for a site, for example: machine ftp.stackoverflow.com login codinghorror password orange then if I want to ftp there from Emacs,…
Skilldrick
  • 69,215
  • 34
  • 177
  • 229
1
vote
1 answer

Python requests module slow due to high number of internal function calls

On one of my machines the Python module requests is extremely slow, seemingly due to a very high number of internal function calls. What could lead to such an issue? >>> import sys, cProfile, requests, urllib3 >>> sys.version '3.10.6 (main, Mar 10…
timss
  • 9,982
  • 4
  • 34
  • 56
1
vote
0 answers

.netrc is not used when venv is active

I have set up a private pypi package index in gitlab. In my ~/.config/pip/pip.conf I setup an extra-index-url # pip.conf [global] extra-index-url=https://gitlab.example.com/api/v4/groups/60/-/packages/pypi/simple Next I setup a ~/.netrc #…
HarryKane
  • 129
  • 3
  • 13
1
vote
0 answers

Is there an equivalent of SSH agent forwarding for curl's .netrc?

I know they're very different different things but is there anything similar to ssh's agent forwarding for the .netrc file? i.e. I want my local .netrc file to be available when I ssh into a remote machine and run curl, but I don't want to copy the…
Milad
  • 4,901
  • 5
  • 32
  • 43
1
vote
1 answer

How to solve _netrc file issue while using NASAaccess package?

I wish to use the NASAaccess tool in R. I have installed the curl software in my system, and also have created the _netrc file in the home directory as instructed (including teh _netrc, .netrc, .urscookie). However when I try to run the code it asks…
1
vote
0 answers

Unable to download private videos in yt-dlp

I have created .netrc then supplied the credentials as as advised in the format machine youtube login myawesomelogin password verycomplicatepass Is there something I need to do again? In downloading I typed: yt-dlp --netrc url
Moses
  • 1,391
  • 10
  • 25
1
vote
0 answers

How to use node-libcurl with NETRC option

I need to make an HTTP GET using curl with netrc file with auth credentials. But I think that I'm doing something brong because I get an HTTP 200 RESPONSE but in the body there is the HTML for the authentication page of the site. This is the code…
1
vote
0 answers

Sonarqube plugin installation using netrCreds

We are installing Sonarqube as a self managed service via the helm charts at https://SonarSource.github.io/helm-chart-sonarqube.. Sonarqube instance was working fine but we did a change to use netrc type Credentials to download plugins from JFrog…
user3616775
  • 75
  • 1
  • 10
1
vote
1 answer

Masking Basic Auth header when using CURL to trigger remote jenkins job

I want to trigger remote Jenkins job from my container(k8s). Currently, I'm using: curl -k -X POST -u $USER:$JENKINS_TOKEN "${JENKINS_URL}/job/{$JOB_NAME}/buildWithParameters?token=12345" But this information($USER,$JENKINS_TOKEN) is displayed in…
Clueless
  • 82
  • 5
1
vote
3 answers

GitHub cookiefile

Since Git uses cURL for HTTP, I am able to have a file ~/.netrc [1] like this: machine github.com login 89z password [Personal access token] However it seems that another option is available, using cookies [2]. It looks like the syntax would be…
Zombo
  • 1
  • 62
  • 391
  • 407
1
vote
1 answer

How to test the non-existence of a file with pytest?

I am not a new developer, but I am new to python. I am modifying an existing routine that checks for a token in an environment variable. I'm modifying it to look in .netrc if the token does not exist in the environment and I want to test it, but I…
harleypig
  • 1,264
  • 8
  • 25