RStudio Server
How to run RStudio Server on a compute node through an SSH tunnel.
This page describes a standard pattern to run RStudio Server on a compute node and reach it safely through an SSH tunnel.
Why This Requires a Compute Node
RStudio Server is an interactive service and must not be started on the login node.
The correct workflow is:
- connect to the login node
- request a SLURM allocation on a compute node
- start RStudio Server inside that allocation
- open an SSH tunnel from your local machine through the login node to the compute node
- connect with a browser to
http://127.0.0.1:PORT
Start an Interactive Allocation
For a lightweight RStudio Server session on the CPU partition, request one CPU:
srun --partition=cpu --ntasks=1 --cpus-per-task=1 --time=02:00:00 --mem=8G --pty bashWhen the shell starts, verify that you are on a compute node:
hostnameKeep this shell open. RStudio Server will run there.
Load the Required Environment
Load the modules you need for R and for RStudio Server. The exact module names may depend on how the service is exposed on NowWhat.
Typical pattern:
module purge
module load apptainer-rstudio-serverStart RStudio Server on the Compute Node
Choose a port that is free on the compute node, for example 8787, and bind the service to localhost:
rstudio --ip 0.0.0.0 --port 8787If your installation exposes a different startup command, adapt the example accordingly. The important part is that the service runs on the compute node and listens only on 127.0.0.1.
Create the SSH Tunnel
Assume:
- your username is
your_username - the login node is
nowwhat.stat.unipd.it - the compute node hostname returned by
hostnameiswn01 - RStudio Server is listening on port
8787
From your local machine, create the tunnel:
ssh -N -L 8787:wn01:8787 your_username@nowwhat.stat.unipd.itThe tunnel path is:
your laptop -> login-nowwhat -> wn01:8787In this setup:
- the browser connects to
127.0.0.1:8787on your machine - SSH forwards that traffic through the login node
- the final destination is port
8787on the compute node where RStudio Server is running
Leave this SSH command running while you use RStudio Server.
Open RStudio Server in the Browser
Open:
http://127.0.0.1:8787If the service requires authentication, use the credentials or token provided by the launched RStudio Server instance.
Important Notes
- do not start RStudio Server on the login node
- the SSH tunnel must be opened from your local machine, not from the compute node
- if the SLURM allocation ends, the service and the tunnel become invalid
- if port
8787is already in use, choose another local and remote port consistently
Minimal Session Checklist
ssh your_username@nowwhat.stat.unipd.itsrun --partition=cpu --ntasks=1 --cpus-per-task=1 --time=02:00:00 --mem=8G --pty bashhostnamemodule purge && module load apptainer-rstudio-serverrstudio --ip 0.0.0.0 --port 8787- from your local machine, run
ssh -N -L 8787:wn01:8787 your_username@nowwhat.stat.unipd.it - open
http://127.0.0.1:8787