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
1
vote
0 answers

.netrc not being used in GitLab CI server

I'm trying to create a CI/CD pipeline, in particular an automated deployment job. In the deploy stage I push my image to Heroku. First, we need to authenticate with Heroku. This is done by placing the username and password in the ~/.netrc file. This…
Greg Peckory
  • 7,700
  • 21
  • 67
  • 114
1
vote
2 answers

How does heroku ensure only app owners can git push to the heroku bare repo

Heroku has a really neat deployment mechanism. It piggybacks on a popular git tool. To deploy, all users have to do is git push heroku master I'm reading https://devcenter.heroku.com/articles/authentication with the hope of setting something up so…
1
vote
1 answer

Using .netrc-file with Vim (as an alternative to DreamWeavers FTP-client)

I'm trying to use Vim as a substitute for DreamWeavers nice FTP-client sidebar. But I would like for Vim to 'remember' my logins, - so I don't need to get the FTP-address, the username and the password, every time I need to connect to a remote…
Zeth
  • 2,273
  • 4
  • 43
  • 91
1
vote
1 answer

How to configure GIT on Windows 7 to push project to Google Code

I would like to push my project to Google Code. I created a new project, in tab Source I have got few instructions how to push my local code. I work on Windows 7, so I created a directory C:\googlecode and I put there file _netrc and…
ruhungry
  • 4,506
  • 20
  • 54
  • 98
1
vote
1 answer

.netrc, .fetchmailrc, and non-hardcoded passwords

Is there any way .netrc or .fetchmailrc can fetch passwords from environment variables, or fetch them from a spawned/forked shell? mutt can do it with something like this: set my_pw_gmail=`some shell command that emits to stdout` Is there any…
RoUS
  • 1,888
  • 2
  • 14
  • 29
1
vote
1 answer

Capistrano ignoring netrc file

I have a PHP web application that I am using Capistrano to deploy. My company moved from using a local git repository to storing our code on Github. Due to some issues beyond our control we cannot use SSH to clone our Github repo. Instead we have…
hernan43
  • 805
  • 1
  • 8
  • 18
0
votes
0 answers

httpx version 0.13.3 [Errno 13] Permission denied: '/root/.netrc' in production server AWS EC2

I have a simple GET request to an endpoint on a Flask server using httpx version 0.13.3. async with httpx.AsyncClient(auth=auth) as client: response = await client.get( url = f"SOME_URL", headers = { …
0
votes
1 answer

Create netrc for Windows (on wine)

Hi I am trying to run wine (for win 64) on docker (ubuntu) and I need to access artifactory/git from inside wine. If I were on docker, I could simply add my credentials to .netrc file. In case of wine, where should I specify these details? I know in…
A Sreek
  • 13
  • 3
0
votes
0 answers

Trying to introduce .netrc file for pip install

Even after placing the .netrc file at the home directory and doing a chown $USER and chmod 600, the pip install asks for user and passowrd. Am I missing anything here so that the .netrc is ignored? .netrc file is like: machine…
rahul raj
  • 105
  • 1
  • 1
  • 13
0
votes
0 answers

Can't fetch or push anything to GitHub via GitHub Desktop

.netrc parser error Suddenly today, i can't fetch or push anything to GitHub via GitHub Desktop. how can i solve this problem? I tried this commands, but nothing is changed. $ git config --global --unset credential.helper $ git config --global…
Observer23
  • 29
  • 6
0
votes
0 answers

Spring WebClient: netrc file content when making http request

Small question regarding Spring Webflux WebClient please. I have a netrc file at ~/.netrc The content is something like: machine example.com login abc password qwerty I use this netrc file in my curl command: curl --netrc --insecure…
PatPanda
  • 3,644
  • 9
  • 58
  • 154
0
votes
0 answers

auto-fill git credentials in docker

I'm using a docker container to access a git repo through aws (don't know if that makes any difference). I've tried using a .netrc file in my home dir in the container but it still asks me for username and password when pulling from the git repo. Is…
Joe
  • 1
0
votes
1 answer

Make .netrc authentication work with aiohttp

I'd like to use a .netrc file with credentials to authenticate to an API using aiohttp. As far as I can tell this should be possible, as long as the file is in the home directory (or the relevant env variable set correctly) and trust_env=True set in…
Val
  • 6,585
  • 5
  • 22
  • 52
0
votes
1 answer

Git: netrc -d -v $@ get: netrc: command not found

I use _netrc on Windows (there are reasons I need to use it) which is setup correctly, but several months ago, when I push to TFS it still asks me for password and I see these 2 warning messages: netrc -d -v $@ get: netrc: command not found netrc -d…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
0
votes
1 answer

MacOS Python 3 netrc operations end up with UnicodeDecodeError

On MacOS (Mojave, same on High Sierra) with Python 3, after installing and using pyenv for some time, seemingly all operations that use a network connection return a UnicodeDecodeError. So far I've tried using various versions of Python 3 (3.6.Xs,…
Ewe123
  • 27
  • 3