TailscaleGuide
Illustrated title card for the guide: Tailscale SSH Setup, Access Rules, and When to Use It
Setup Guides

Tailscale SSH Setup, Access Rules, and When to Use It

Set up Tailscale SSH, allow a specific local login with a grant and an SSH rule, and decide when to keep OpenSSH on your tailnet.

By TailscaleGuide Editorial · ·Updated · 4 min read

Tailscale SSH lets you control SSH logins through your tailnet policy using Tailscale identities. Turn it on at the destination and make sure your policy allows the source to reach TCP port 22 and use the local account under an SSH rule. Tailscale SSH

Choose Tailscale SSH or OpenSSH over Tailscale

Tailscale SSHOpenSSH over Tailscale
Tailscale’s SSH server handles connections to port 22 on the host’s Tailscale IP. Tailscale authenticates the source and uses tailnet policy to authorize the login. Tailscale SSHYour existing SSH server handles the login using its configured authentication. Tailscale provides the network path and controls which sources can reach the server over the tailnet. Protect your SSH servers using Tailscale
Use it when you want tailnet identities to control logins. A rule in check mode can require the user to sign in again. Tailscale SSHConsider keeping OpenSSH if you rely on authorized_keys to restrict which commands remote users can run. Check mode applies only to Tailscale SSH. Tailscale SSH

Check which devices can host a session

The server component requires Tailscale v1.24 or later on Linux or on macOS with the open-source tailscale and tailscaled CLI build. Synology and QNAP devices are excluded. A device reached through a subnet router still needs to run Tailscale itself to host Tailscale SSH. Tailscale SSH

Any device running Tailscale can initiate a connection, regardless of platform. Tailscale SSH

For the setup below, use a client and host on the same tailnet. If you still need to join your devices, follow the Tailscale setup guide.

Allow one login in Access controls

If you have permission to edit the tailnet policy, open Access controls in the admin console and use the JSON editor. Tailscale SSH · Visual policy editor reference

A grant with "ip": ["tcp:22"] allows traffic from the source to the destination on TCP port 22. The separate ssh rule authorizes the source to sign in as a specified account on the destination. Grants explained · Tailnet policy syntax

A broader grant can still allow traffic to the same destination, and another SSH rule may match a different login. Grants explained

Merge these entries into the corresponding sections of your existing policy. Replace [email protected] with your Tailscale login from Users, and replace local-user with an existing non-root account on the host. SSH into a Linux VM

{
  "tagOwners": {
    "tag:server": ["[email protected]"]
  },
  "grants": [
    {
      "src": ["[email protected]"],
      "dst": ["tag:server"],
      "ip": ["tcp:22"]
    }
  ],
  "ssh": [
    {
      "action": "check",
      "src": ["[email protected]"],
      "dst": ["tag:server"],
      "users": ["local-user"]
    }
  ]
}
  • src is the tailnet identity that starts the connection. You can use an individual Tailscale login as shown or a defined group:<name> to match members of that group. Tailscale SSH
  • dst is the destination. The tag selects devices carrying tag:server. For connections between devices owned by the same user, an SSH rule can use autogroup:self with a user or group source. Tailnet policy syntax
  • users lists existing OS accounts on the destination. In this rule, the Tailscale identity can request the local-user login. Tailnet policy syntax

Apply the destination tag

  • Save the policy with tag:server defined in tagOwners. Group devices with tags
  • Applying a tag to a user-owned device replaces its user identity with a tag-based identity. Group devices with tags
  • To apply a tag as a tailnet Owner, Admin, or Network admin, find the host in Machines and open the menu at the far right of its row. Select Edit tags, add tag:server, and select Save. Group devices with tags

Choose between check and accept

A check rule requires periodic sign-in through the user’s identity provider. The example leaves checkPeriod at its 12-hour default. When a check is due, SSH provides a sign-in URL. Tailscale SSH

An accept rule permits a matching login from a source already authenticated to the tailnet. For a tagged source device, use accept and a tagged destination. Tailscale SSH

See the Tailscale ACL examples for more policy patterns.

Enable Tailscale SSH on the destination

Run this command on the destination. Existing SSH connections to its Tailscale IP will hang when you run it. Tailscale SSH

tailscale set --ssh

Connect and verify the first login

From the client, use the host’s Tailscale IP from Machines and the local account allowed by the SSH rule. Replace the example address and username with yours. You can also use the host’s MagicDNS name. SSH into a Linux VM

ssh [email protected]

If the client uses userspace networking and cannot connect directly, use the Tailscale CLI form on a build that provides it. Tailscale CLI

tailscale ssh [email protected]

Open the sign-in URL on the initiating device if prompted and authenticate with your identity provider. Tailscale SSH

If the login fails, check these settings.

  1. Host setting. Confirm you enabled Tailscale SSH on the destination. Tailscale SSH
  2. Network permission. Confirm a grant or ACL lets the source reach TCP port 22 on that destination. Tailnet policy syntax
  3. Login permission. Check that an SSH rule matches the source, destination tag, and requested OS account. Verify the account exists on the host. Tailnet policy syntax

Evidence and limits. Tailscale’s official feature, policy, and CLI documentation was checked on November 28, 2026. No hands-on testing was performed for this guide. The feature guide documents server support starting with v1.24. Tailscale SSH

Sources

  1. Tailscale SSH
  2. Protect your SSH servers using Tailscale
  3. Syntax reference for the tailnet policy file
  4. Grants explained
  5. Visual policy editor reference
  6. Group devices with tags
  7. SSH into a Linux VM
  8. Tailscale CLI

Related