tailscale: `tailscale ssh` server doesn't start in the macOS Standalone variant

What is the issue?

$ /Applications/Tailscale.app/Contents/MacOS/Tailscale ssh ws-1
Pseudo-terminal will not be allocated because stdin is not a terminal.
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

Steps to reproduce

Run /Applications/Tailscale.app/Contents/MacOS/Tailscale ssh <host> on any macOS machine, where <host> is any Tailscale node.

Are there any recent changes that introduced the issue?

No response

OS

macOS

OS version

12.2.1

Tailscale version

1.24

Bug report

No response

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 8
  • Comments: 33 (10 by maintainers)

Commits related to this issue

Most upvoted comments

There is no actual bug here… but that error message should have been less technical to prevent user confusion. Let me explain here.

The error you’re seeing says that the built-in Tailscale SSH server is unable to run in any sandboxed Tailscale build for macOS. Sandboxing limitations by Apple prevent the Tailscale network extension from running as an SSH server: the extension does run as root but is sandboxed by the operating system, so it won’t be able to open a terminal on behalf of your local user account. We must break out of the sandbox to do that.

We could fix this in the future by bundling a separate process (a LaunchDaemon, more specifically) acting as a SSH server within the Standalone variant. This is a lot of work as it requires an intense amount of XPC between this SSH daemon and the pre-existing system extension. We would also need to create an UI experience to escalate as root in the client UI to install such LaunchDaemon. We will never, ever be able to support this thing on the App Store variant as it is prohibited by the App Store guidelines.

For now, you may run your own SSH server or simply use the built-in SSH server in macOS, and then connect to that server using Tailscale as a workaround.

Advanced users may also install the open-source variant of Tailscale (brew install tailscale) which is not subject to restrictions, includes an SSH server, but also comes with a large number of limitations (for starters, it doesn’t have a GUI and doesn’t integrate with the macOS VPN settings).

I’m re-opening this issue to track bundling an SSH server within the Standalone variant of Tailscale for macOS. But as I explained above, it is a lot of work and I cannot provide any timeline.

For now, you may run your own SSH server or simply use the built-in SSH server in macOS, and then connect to that server using Tailscale as a workaround.

Documentation for this would be really helpful. My use case for wanting an SSH server is so I can connect to my mac with VSCode’s “Connect to Remote Host” capability (rather than a remote tunnel) and to do so without exposing the SSH port on my mac. From what I can tell, VSCode relies on the native ssh client, so tailscale ssh <name>@<host> won’t work.

Advanced users may also install the open-source variant of Tailscale (brew install tailscale) which is not subject to restrictions, includes an SSH server, but also comes with a large number of limitations (for starters, it doesn’t have a GUI and doesn’t integrate with the macOS VPN settings).

This would also be good to be documented since I’m not sure what “not integrating with the VPN settings” limits me from doing.

The Tailscale Youtube series has been excellent and I could see “escaping sandbox mode on a mac” being a good topic for a video.

I’m on macOS Sequoia 15.1.1 on a brand new M4 Mac Mini with only a handful of productivity apps installed so far so it’s unlikely they’re interfering somehow. I also tried Tailscale 1.76.6 and 1.76.1 and both give me the same error.

Yes, I downloaded 1.76.6 directly from the tailscale website and it is still showing the following error when I am enabling the SSH on my M4 Mac.

The Tailscale SSH server does not run in sandboxed Tailscale GUI builds.

The version of Tailscale distributed directly by Tailscale (Standalone variant, distributed on pkgs.tailscale.com) is the only one that currently supports this (using tailscale ssh as an SSH client). There is no plan to bring this to the App Store version, as it is technically unfeasible due to Apple’s sandboxing restrictions. Please see https://tailscale.com/kb/1065/macos-variants for more details about the different Tailscale variants on macOS.

image

Same thing with a Standalone Version 1.77.103

tailscale up --ssh --accept-routes --exit-node-allow-lan-access --exit-node=1--.---.---.--
2024/11/19 15:17:34 The Tailscale SSH server does not run in sandboxed Tailscale GUI builds.

I will try to uninstall and download from pkgs.tailscale.com – Edit : image

Same error, I removed my app and restarted prior to install the version 1.76.6 from pkgs.tailscale.com

Hi! First of all thank you very much for this awesome product that I can use for free.


I installed Tailscale both from App Store, and then from Homebrew (of course after uninstalling from App Store first), and in both cases I get:

2024/02/28 22:32:22 The 'tailscale ssh' subcommand is not available on sandboxed macOS builds.
Use the regular 'ssh' client instead.

I think “sandboxed macOS builds” is not very obvious, at least not to me (sorry). Initially I expected that only the Tailscale app installed from App Store is “sandboxed”, but turns out that the standalone one is sandboxed as well (because tailscale ssh doesn’t work).

Same error here.

Setting up a new machine with tailscale after downloading the one from “Download tailscale” button on https://tailscale.com/kb/1065/macos-variants, I still get this error.

Trying to set up macOS as an SSH host, over tailscale, to connect from a tailscale client.

@agottardo I seem to be getting the same error even with the brew version installed.

Same here. I had the MAS version installed. I removed it and re-installed the Tailscale-1.78.1-macos.pkg.

@agottardo Super helpful, thanks. If you think that you’re the victim of a bug, that’s frustrating.

When you know it’s just a limitation, the frustration goes away!

Having the same error after trying it from multiple machines using the standalone version

Same here Sonoma 14.7.1, running Standalone version after uninstalling App Store version

tailscale set --ssh 2025/01/19 15:48:32 The Tailscale SSH server does not run in sandboxed Tailscale GUI builds.

tailscale version 1.78.1 tailscale commit: 8903926f7167f4c4a2e21a6e3c0dae855322f3d6 other commit: c4163954ed6b6d5e1fa9d6ae9d88e096ed361d71 go version: go1.23.3

I’m getting exactly the same error with the standalone variant (Version 1.78.1) on macOS (Ventura 13.7.2). Please re-open the issue.

@geoffeg, this issue is specifically about the sandboxed Tailscale CLI which neither of your example ssh paths are using. So this is the wrong issue.

I see. I’ll ask my team to try that. My understanding is that, they were trying to use the normal ssh, which didn’t work. Then tried tailscale ssh, and that didn’t work. Anyways, will confirm.

@manishrjain, you can just use the normal “ssh” command from macOS to a Linux Tailscale SSH machine. You don’t need the “tailscale ssh” subcommand.

Echo this same issue. My teammates aren’t able to ssh into machines where tailscale is controlling ssh via their Mac systems. So, I had to disable tailscale ssh and revert back to normal ssh.

I looked into this a bit. The tcsetattr: Operation not permitted is due to not being able to set the tty in raw mode at https://github.com/openssh/openssh-portable/blob/2dc328023f60212cd29504fc05d849133ae47355/sshtty.c#L93.

I thought that this was maybe due to the ssh process not inheriting some permissions, so I tried doing this directly in the ssh.go CLI command (via termios.Raw), but that got the same permission error.

Looking at the console, there is a Sandbox: ssh(10318) deny(1) file-ioctl /dev/ttys001 line (tcsetattr is implemented in terms of ioctl), which suggests that this is indeed a sandbox limitation.

Looking at the default sandbox profile for apps (/System/Library/Sandbox/Profiles/application.sb), there are a few places where file-ioctl is allowed: (allow file-read* file-write* file-ioctl (literal "/dev/ptmx")) and something relating to application groups that I don’t think is relevant.

Can we perhaps use /dev/ptmx (which can be put into raw mode) and connect it to stdin?

This may also be something for @nickoneill to bring up at the next WWDC. I can also try to make a self-contained sample and see if Quinn or someone else from Apple in their forums has ideas.