Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


A Modern and Flexible Web Client for R

Build Status CRAN_Status_Badge CRAN RStudio mirror downloads Research software impact Github Stars

The R package RAppArmor interfaces to a number of security related methods in the Linux kernel. It supports the following functionality:

  • loading and changing AppArmor profiles and hats to enforce advanced security policies
  • setting RLIMIT values to restrict usage of memory, cpu, disk, etc
  • setting the process priority
  • switching uid/gid of the current process
  • setting the affinity mask of the current process
  • calling an R command with a 'timeout' to kill if it does not return with in n seconds
  • doing all of the above dynamically for a single R call using the function

This can be useful for example if to host a public service for users to run R code, or if you are paranoid about running contributed code on your machine.


About the R package:

Hello World

Use the function to dynamically evaluate a call with a certain AppArmor profile or hardware limits:

list.files("/")"/"), profile="r-user")

To set hardware limits, use the RLIMIT_XXX arguments:

A <- matrix(rnorm(1e7), 1e4);
B <-, 1e4), RLIMIT_AS = 100*1024*1024);


The AppArmor linux module is available on the following distributions:

Installing the R package requires libapparmor-dev. The apparmor-utils package is also recommended.

sudo apt-get install -y libapparmor-dev apparmor-utils

One this is installed we can install the R package:


The R package comes with some AppArmor profiles that you need to install manually:

#Install the profiles
cd /usr/local/lib/R/site-library/RAppArmor/
sudo cp -Rf profiles/debian/* /etc/apparmor.d/

#Load the profiles into the kernel
sudo service apparmor restart

#To disable enforcing the global R profile
sudo aa-disable usr.bin.r

To start enforcing the standard R policy:

sudo aa-enforce usr.bin.r

To stop enforcing of the standard policy:

sudo aa-disable usr.bin.r

Please have a look at the JSS paper to understand how to use the software.


To cite RAppArmor in publications use:

Jeroen Ooms (2013). The RAppArmor Package: Enforcing Security Policies in R Using Dynamic Sandboxing
on Linux. Journal of Statistical Software, 55(7), 1-34. URL

A BibTeX entry for LaTeX users is

  title = {The {RAppArmor} Package: Enforcing Security Policies in {R} Using Dynamic Sandboxing on Linux},
  author = {Jeroen Ooms},
  journal = {Journal of Statistical Software},
  year = {2013},
  volume = {55},
  number = {7},
  pages = {1--34},
  url = {},