LogoFreestyle

SSH Access

SSH into your Freestyle VMs.

SSH Format

ssh vm-id@vm-ssh.freestyle.sh
ssh vm-id:access-token@vm-ssh.freestyle.sh
ssh vm-id+user:access-token@vm-ssh.freestyle.sh

SSH as Root

To SSH into a VM as root, create an identity with permission to access the VM, then create an access token for that identity:

import { freestyle } from "freestyle-sandboxes";

const { vmId } = await freestyle.vms.create();

const { identity } = await freestyle.identities.create();
await identity.permissions.vms.create({
  vmId: vmId,
});

const { token } = await identity.createToken();

console.log(`ssh ${vmId}:${token}@vm-ssh.freestyle.sh`);

If you omit the token from the URL, you will be prompted for it as a password:

ssh {vm-id}@vm-ssh.freestyle.sh
# You'll be prompted: Enter your access token as the password

SSH as a Specific User

Create an identity with permission to access the VM as a specific Linux user:

const { vmId } = await freestyle.vms.create({
  users: [
    { name: "developer" },
    { name: "admin" },
  ],
});

const { identity } = await freestyle.identities.create();

await identity.permissions.vms.create({
  vmId: vmId,
  allowedUsers: ["developer"],
});

const { token } = await identity.createToken();

console.log(`ssh ${vmId}+developer:${token}@vm-ssh.freestyle.sh`);

Multiple Developers

Create separate identities for each developer with their own permissions:

const { vmId } = await freestyle.vms.create({
  users: [
    {
      name: "alice",
      gecos: "Alice Smith",
      groups: ["sudo", "docker"],
    },
    {
      name: "bob",
      gecos: "Bob Jones",
      groups: ["sudo", "docker"],
    },
  ],
});

// Create separate identities for each developer
const { identity: aliceIdentity } = await freestyle.identities.create();
await aliceIdentity.permissions.vms.create({
  vmId: vmId,
  allowedUsers: ["alice"],
});

const { identity: bobIdentity } = await freestyle.identities.create();
await bobIdentity.permissions.vms.create({
  vmId: vmId,
  allowedUsers: ["bob"],
});

const { token: aliceToken } = await aliceIdentity.createToken();
const { token: bobToken } = await bobIdentity.createToken();

console.log(`Alice: ssh ${vmId}+alice:${aliceToken}@vm-ssh.freestyle.sh`);
console.log(`Bob: ssh ${vmId}+bob:${bobToken}@vm-ssh.freestyle.sh`);

On this page

Freestyle AI

Documentation assistant

Experimental: AI responses may not always be accurate—please verify important details with the official documentation.

How can I help?

Ask me about Freestyle while you browse the docs.