A netrc file is used to hold credentials necessary to login to your labkey server and authorize access to data stored there. The netrc file contains configuration and autologin information for the File Transfer Protocol client (FTP) and other programs. It may be used when working with SAS Macros
, Transformation Scripts in Java
or using the Rlabkey package
If you receive "unauthorized" error messages when trying to retrieve data from a remote server you should check that your netrc file is configured correctly, you have an entry for that remote machine, and the login credentials are correct.
Set up a .netrc or _netrc file
On a UNIX or Linux system this file should be named .netrc (dot netrc) and on Windows it should be named
_netrc (underscore netrc). The file should be located in your home directory and the permissions
on the file should be unreadable for everyone except you.
To create the _netrc on a Windows machine, first create an environment variable called ’HOME’
that is set to your home directory (c:/Users/<User-Name> on Vista or Windows 7) or any directory you want to
use. Two equivalent examples:
SET HOME="C:\Program Files\r\R-2.10\library"
SET HOME=C:\Program Files\r\R-2.10\library
In that directory, create a text file named _netrc (note that it is underscore netrc, not dot netrc
like it is on UNIX).
The following three lines must be included in the .netrc or _netrc file. They must be separated by either white space
(spaces, tabs, or newlines) or commas:
One example would be:
Another example would be:
machine mymachine.labkey.org login email@example.com password mypassword
The _netrc file only deals with connections at the machine level and does not include a port or protocol designation.