SSH and Linux Users
SSH into your VM using Freestyle Identities
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.shSSH 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 passwordSSH as a Linux User
To control access to linux-level permissions in your VM, you can configure multiple users when creating your vm.
import { freestyle } from "freestyle-sandboxes";
const { vmId } = await freestyle.vms.create({
users: [
{ name: "developer" },
{ name: "admin" },
],
});Then you can SSH into the VM as that user by creating an identity with permission to access the VM as that user.
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`);