[R] Password protected R Repository

Stefan Petersson stefan.petersson at inizio.se
Wed Sep 28 11:47:06 CEST 2011


 <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:
> 
> 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)



More information about the R-help mailing list