Handling long-running sessions in RStudio Workbench / RStudio Server Pro with Kerberos


Many companies use Kerberos with RStudio, using PAM modules to generate the necessary Kerberos ticket on login (see here).

If you are using Kerberos with RStudio Workbench (previously RStudio Server Pro) in this fashion, you may notice issues when a session is running or left suspended for a long period of time where the Kerberos ticket expires while the session is still ongoing. There are a few methods to deal with this, depending on your needs:

  • The simplest is just to have your users log out and then log back in - provided you've set up your authentication system to generate Kerberos tickets on login, this should cause a new Kerberos ticket to be generated.
  • You can place a kinit command in your .Rprofile or Rprofile.site file, then set
    This will cause that line to be re-run whenever a session is resumed. Note that any other lines in your .Rprofile or Rprofile.site will also be run, so you may need to take care that re-running those lines won't cause any issues with users' ongoing work. See here for more. 
  • Users can run a command like kinit in the console (via system("kinit")) to cause a new Kerberos ticket to be generated in the session
  • Finally, you can write your code for your database to check for a Kerberos ticket, and if the ticket is expired, run a command at that point to generate a new ticket - you could include something like
    system('kinit', input=.rs.askForPassword("Enter your Password:")) to also require a password for added security.