Skip to main content

Keeping secrets out of scripts

Startup scripts are stored with your reservation. Here's how to use tokens and keys without putting them in one.

On this page

Every startup script editor carries this warning:

This script is stored with your reservation and runs once as renter when your machine is ready; its output goes to ~/startup.log. Be mindful about API keys, tokens or passwords in it.

A startup script travels with your reservation: it's saved as plain text with it, and kept in your reservation's record after the reservation ends. During the rental a readable copy also sits on the machine, at /usr/local/var/renter-startup/startup, and anything the script prints ends up in ~/startup.log. Anything in the script — a Hugging Face token, a cloud access key or a password — goes everywhere the script goes. Treat a script like a file you might share, not like a password manager.

Do this instead

Copy a credentials file over SSH once the machine is ready, rather than pasting its contents into a script. This is the option we recommend. The example uses port 2211; use your reservation's port:

bash
ssh -p 2211 renter@ssh.gputorent.com mkdir -p .config/my-tool
scp -P 2211 ~/.config/my-tool/credentials.json renter@ssh.gputorent.com:~/.config/my-tool/

Log in and set the secret for your session. Once you're connected, export it in your shell. It exists only on the machine, only until the reservation ends:

bash
read -rs HF_TOKEN && export HF_TOKEN    # paste the token; it isn't echoed
hf download meta-llama/Llama-3.3-70B-Instruct

Use a tool's own login. Many CLIs store credentials in your home folder on the machine, which is erased at the end of the reservation:

bash
hf auth login

Where hf is depends on how it was installed: our Mac Studio template puts it in ~/.venvs/mlx/bin, and the DGX Spark template in ~/.local/bin.

Let the script do everything that doesn't need a secret. Install packages and download public models in the startup script; do the rest by hand.

If you must use a token in a script

Sometimes a download has to start before you log in. If you put a token in a script:

  • use a short-lived token, one that expires soon after your reservation ends,
  • make it fine-grained and read-only, with access to just what the script needs,
  • don't print it, so it stays out of ~/startup.log, and
  • revoke it once your reservation has ended.

What happens to your data

The script is deleted from the machine when the rental ends. Everything else on the machine is erased too, including any secrets you exported, logged in with or copied over, and the log. The script text stays in your reservation's record. See Reservation lifecycle and our Privacy Policy.