[R] Password protected R Repository
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]] __ R-help@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.
Re: [R] Password protected R Repository
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 htmlhead title403 Forbidden/title /headbody h1Forbidden/h1 pYou 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@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.
Re: [R] Password protected R Repository
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 htmlhead title403 Forbidden/title /headbody h1Forbidden/h1 pYou 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@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, rip...@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, UKFax: +44 1865 272595__ R-help@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.
Re: [R] Password protected R Repository
Prof Brian Ripley ripley at stats.ox.ac.uk writes: 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: The helpfiles for 'download.file' was not that helpful. But maybe it's just me not being able to read them correctly. I tried to call install.packages with the 'method=wget', and hoped for a username and password dialog. But no luck. Other than that, I see no arguments that relates to my problem under ?download.file. Which btw is 'installing an R library from a password protected URL (Apache Basic Authentication)'. Actually, nobody said that RCurl::getURL would work with install.packages, but from what was written in a post somewhere I jumped to the (false) conclusion that it would work. That's why I tried it. Any hints would be greatly appreciated! __ R-help@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.
Re: [R] Password protected R Repository
On 28.09.2011 15:51, Stefan Petersson wrote: Prof Brian Ripleyripleyat stats.ox.ac.uk writes: 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: The helpfiles for 'download.file' was not that helpful. But maybe it's just me not being able to read them correctly. Yes, looks like this is the case. I tried to call install.packages with the 'method=wget', and hoped for a username and password dialog. But no luck. The help page says if proper values are stored in the configuration file for wget, so why do you expect a dialog? Best, Uwe Ligges Other than that, I see no arguments that relates to my problem under ?download.file. Which btw is 'installing an R library from a password protected URL (Apache Basic Authentication)'. Actually, nobody said that RCurl::getURL would work with install.packages, but from what was written in a post somewhere I jumped to the (false) conclusion that it would work. That's why I tried it. Any hints would be greatly appreciated! __ R-help@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. __ R-help@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.
Re: [R] Password protected R Repository
The helpfiles for 'download.file' was not that helpful. But maybe it's just me not being able to read them correctly. Yes, looks like this is the case. I tried to call install.packages with the 'method=wget', and hoped for a username and password dialog. But no luck. The help page says if proper values are stored in the configuration file for wget, so why do you expect a dialog? Best, Uwe Ligges Well, I expect a dialog because when I use (for example) ncftp without a conf file, I get a dialog asking me for site, usr and pwd. For me, not being a black belt R user, it's not so strange expecting a dialog of some kind when a usr/pwd is required. But maybe that's just me... And I misunderstood the helpfile. I thought it referred to proxy servers alone, and that it didn't concern Apache Authentication. My error. Thanks for clearing that up. My misunderstanding - Method ‘wget’ can be used with proxy firewalls which require user/password authentication if proper values are stored in the configuration file for ‘wget’. So, I added 'http_user=usr' and 'http_passwd=pwd' to my /etc/wgetrc and run: install.packages(repos='http://www.myServer.se/myRepo/', method='wget', pkgs='myLib', dep=TRUE) Bob is my uncle! __ R-help@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.