[R] Password protected R Repository

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Sep 28 12:11:08 CEST 2011


Who said that RCurl::getURL worked with install.packages?
(At least, I assume this is from RCurl: you did not mention it.)

install.packages() first calls available.packages(), and that uses 
download.file to get the PACKAGES[.gz] file.  It then calls 
download.file to get the packages.

So please read the help for download.file (as the help pages say), and 
try the solutions described there.

On Wed, 28 Sep 2011, Stefan Petersson wrote:

> <stefan.petersson <at> inizio.se> writes:
>
>>
>>
>> Hi,
>>
>> I've set up a very simple R repository. Just a single source
>> library. Everything works fine. I can install the package on my client
>> using:
>>
>> install.packages(repos='http://www.myServer.se/myRepo/',
>> pkgs='myLib', dep=TRUE)
>>
>> However, I want to protect the repo, so I use a
>> .htaccess, placed directly under 'myRepo' on the server. I use
>> 'Authentication Basic' and 'require valid-user'.
>>
>> I've tried a few
>> things. From the
>> obvious:

*None* of this is 'obvious', and none of it is reproducible.

>> install.packages(repos=getURL('http://www.myServer.se/myRepo',
>> userpwd='user:password'), pkgs='myLib', dep=TRUE)
>>
>> To the more
>> elaborate:
>>
>> h
>> 	[[alternative HTML version deleted]]
>>
>>
> I add this myself, since some strange 'alternative HTML version deleted' thingy
> cut my post short. Here is the rest:

> To the more elaborate:
>
> h <- getCurlHandle(header = TRUE,
> 	userpwd = "user:password",
> 	netrc = TRUE,
> 	followlocation = TRUE
> )
>
> install.packages(getURL("http://www.myServer.se/myRepo/",
> 		verbose = TRUE,
> 		curl = h
> 	),
> 	pkgs='myLib',
> 	dep=TRUE
> )
>
> But it's not working. The last call is complaining of a missing index.html. And
> if I put one under myRepo, I get connected to that page, but install.packages
> can't go further to the src directory on the server. This is what I get:
>
> Installing package(s) into ‘/usr/local/lib/R/site-library’
> (as ‘lib’ is unspecified)
> Warning: unable to access index for repository HTTP/1.1 301 Moved Permanently
> Date: Wed, 28 Sep 2011 09:20:25 GMT
> Server: Apache
> Location: http://www.myServer.se/myRepo/
> Vary: Accept-Encoding
> Content-Length: 235
> Content-Type: text/html; charset=iso-8859-1
>
> HTTP/1.1 403 Forbidden
> Date: Wed, 28 Sep 2011 09:20:25 GMT
> Server: Apache
> Vary: Accept-Encoding
> Content-Length: 208
> Content-Type: text/html; charset=iso-8859-1
>
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <html><head>
> <title>403 Forbidden</title>
> </head><body>
> <h1>Forbidden</h1>
> <p>You don't have permission to access /smisc/
> on this server.</p>
> </body></html>
> /src/contrib
> Warning message:
> In getDependencies(pkgs, dependencies, available, lib) :
>  package ‘smisc’ is not available (for R version 2.13.1)
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-help mailing list