Thursday, July 11, 2013

How to install RStudio and configure with LDAP

RStudio is a free and open source integrated development environment for R. You can run it on your desktop (Windows, Mac, or Linux) or even over the web using RStudio Server. To install RStudio, you need R (2.11.1 or higher).

The official RStudio website has a very intuitive installation instructions, just follow it. This post shows you how to configure RStudio with LDAP.


RStudio authenticates users via PAM (http://en.wikipedia.org/wiki/Linux_PAM). By default out of the box this means that any (non-system) user with an account on your system box can login using their Linux credentials.

If you want to setup LDAP access you need to create/edit an RStudio PAM configuration file as appropriate. The location of the file should be /etc/pam.d/rstudio.

First make a copy of the original rstudio pam file /etc/pam.d/rstudio.
$ cp  /etc/pam.d/rstudio  /etc/pam.d/rstudio-org

Make the following changes:
$ vi  /etc/pam.d/rstudio
s/pam_unix/pam_ldap/g
# Or if you are using other editor, just replace pam_unix with pam_ldap.

After save the file you should be able to use LDAP account to log into RStudio.

If you can LDAP into RStudio server but can't log into RStudio from web UI, and getting the following error message:
Jan  7 11:43:32 server1 rserver-pam[2408]: illegal option nodelay
Jan  7 11:43:32 server1 rserver-pam[2408]: pam_ldap: ldap_simple_bind Can't contact LDAP server
Jan  7 11:43:32 server1 rserver-pam[2408]: pam_ldap: reconnecting to LDAP server...
Jan  7 11:43:32 server1 rserver-pam[2408]: pam_ldap: ldap_simple_bind Can't contact LDAP server
Jan  7 11:43:32 server1 rserver-pam[2408]: ERROR pam_authenticate failed: Authentication service cannot retrieve authentication info; LOGGED FROM: int server::pam::PAM::login(const std::string&, const std::string&) /root/rstudio/src/cpp/server/pam/Pam.cpp:184

Make sure you can ping or connect your LDAP server from your RStudio server.

2 comments:

ende said...

Tony, and chance you can elaborate on that last point? I'm getting that exact error but have no idea what to do about it.

Thanks.

Tony Xu said...

Hi Ende, make sure form your RStudio server, you can ping you ldap server and connect to it from command line. You can use ldapsearch for example:
# ldapsearch -h ldapserver -x -b 'dc=yourdomain,dc=com', you should be able to see all the ldap accounts.

Also make sure you have your home directory created, RStudio webUI uses your home directory for writing some configuration files.